int age=25;
if (age>60) {
System.out.println("老年");
}
else if (60>=age&&age>=40) {
System.out.println("中年");
}
else if (40>=age&&age>=18) {
System.out.println("少年");
}
else {
System.out.println("童年");
}
if (age>60) {
System.out.println("老年");
}
else if (60>=age&&age>=40) {
System.out.println("中年");
}
else if (40>=age&&age>=18) {
System.out.println("少年");
}
else {
System.out.println("童年");
}
2015-08-06
public class HelloWorld{
public static void main(String[] args) {
final String Sex1 = "女";
final String Sex2 = "男";
System.out.println(Sex1+"\n"+Sex2);
}
}
public static void main(String[] args) {
final String Sex1 = "女";
final String Sex2 = "男";
System.out.println(Sex1+"\n"+Sex2);
}
}
2015-08-05
public void sort( int scores[] ){
Arrays.sort(scores);
System.out.println("考试成绩的前三名为:");
for(int num = 0 ,i =scores.length-1;num<3;i--){
if(scores[i]>=0&&scores[i]<=100){
System.out.println(scores[i]);
num++;
}}}
Arrays.sort(scores);
System.out.println("考试成绩的前三名为:");
for(int num = 0 ,i =scores.length-1;num<3;i--){
if(scores[i]>=0&&scores[i]<=100){
System.out.println(scores[i]);
num++;
}}}
if(sex.equals("男")){
System.out.println("进入男子决赛组");
}else{
System.out.println("进入女子决赛组");
}
}
}
}
System.out.println("进入男子决赛组");
}else{
System.out.println("进入女子决赛组");
}
}
}
}
2015-08-05
int count=sort(scores);
public int sort( int scores[] ){
Arrays.sort(scores);
System.out.println(Arrays.toString(scores));
return scores.length;
public int sort( int scores[] ){
Arrays.sort(scores);
System.out.println(Arrays.toString(scores));
return scores.length;
2015-08-05