public clas HelloWorld{
public static void main(String[]args){
String _1 = "我爱慕课网";
System.out.println(1);
String _2 = "www.imooc.com";
System.out.println(2);
}
}
public static void main(String[]args){
String _1 = "我爱慕课网";
System.out.println(1);
String _2 = "www.imooc.com";
System.out.println(2);
}
}
2015-05-20
System.out.println("打印直角三角形");
for(int s = 1 ; s <= 3 ; s++){
for(int j = 1; j <= 1; j++){
System.out.println("*");
System.out.println();}}
写出来不是直角三角形额... ...一竖行*
for(int s = 1 ; s <= 3 ; s++){
for(int j = 1; j <= 1; j++){
System.out.println("*");
System.out.println();}}
写出来不是直角三角形额... ...一竖行*
2015-05-20
public void functionTop3(int[] scores){
Arrays.sort(scores);
int nums = 0;
for(int i=scores.length-1 ; i>=0 ; i--){ //降序
if(scores[i]<0 || scores[i]>100){
continue; //无效跳出循环 忽略本次成绩
}
nums++;
if(nums>3){ 结束循环
break;
}
System.out.println(scores[i]);
}
}
Arrays.sort(scores);
int nums = 0;
for(int i=scores.length-1 ; i>=0 ; i--){ //降序
if(scores[i]<0 || scores[i]>100){
continue; //无效跳出循环 忽略本次成绩
}
nums++;
if(nums>3){ 结束循环
break;
}
System.out.println(scores[i]);
}
}
public void functiontop3(int[] scores){
Arrays.sort(scores);
int[] score2;
score2 =new int[3];
score2[0]=scores[4];
score2[1]=scores[5];
score2[2]=scores[6];
System.out.println( Arrays.toString(score2) );
}
这样是不是好理解些
Arrays.sort(scores);
int[] score2;
score2 =new int[3];
score2[0]=scores[4];
score2[1]=scores[5];
score2[2]=scores[6];
System.out.println( Arrays.toString(score2) );
}
这样是不是好理解些
switch(today){
case '一':
case '三':
case '五':
System.out.println("吃包子");
break;
case '二':
case '四':
case '六':
System.out.println("吃油条");
break;
default:
System.out.println("吃主席套餐");
}一个全角冒号搞了一个小时,晕!!!
case '一':
case '三':
case '五':
System.out.println("吃包子");
break;
case '二':
case '四':
case '六':
System.out.println("吃油条");
break;
default:
System.out.println("吃主席套餐");
}一个全角冒号搞了一个小时,晕!!!
2015-05-20