public int getMaxAge() {
int [] ages={18,23,21,19,25,29,17};
Arrays.sort(ages);
return ages[ages.length-1];
int [] ages={18,23,21,19,25,29,17};
Arrays.sort(ages);
return ages[ages.length-1];
2015-05-14
public int getMaxAge() {
int [] ages={18,23,21,19,25,29,17};
int max=ages[0];
for(int i=0;i<ages.length;i++){
if(ages[i]>max)
max=ages[i];
}
return max;
int [] ages={18,23,21,19,25,29,17};
int max=ages[0];
for(int i=0;i<ages.length;i++){
if(ages[i]>max)
max=ages[i];
}
return max;
2015-05-14
public class HelloWorld{ public static void main(String[] args){
String hobby='慕课网';
}
} { System.out.println('慕课网:'+hobby;
hobby='慕课网';
System.out.println('慕课网':'+hobby); } }
String hobby='慕课网';
}
} { System.out.println('慕课网:'+hobby;
hobby='慕课网';
System.out.println('慕课网':'+hobby); } }
for (int i = 1;i<=3;i++ ) {
// 内层循环控制每行的*号数
// 内层循环变量的最大值和外层循环变量的值相等
for (int j = 1;j<=i;j++ ) {
System.out.print("*");
}
// 每打印完一行后进行换行
System.out.println();
}
// 内层循环控制每行的*号数
// 内层循环变量的最大值和外层循环变量的值相等
for (int j = 1;j<=i;j++ ) {
System.out.print("*");
}
// 每打印完一行后进行换行
System.out.println();
}
2015-05-12