|
// Java三个正整数求最大值——嵌套分支
|
|
package xiangmu;
|
|
|
|
public class Ceshi {
|
|
public static void main(String args[]) {
|
|
int a = 9;
|
|
int b = 10;
|
|
int c = 8;
|
|
if(a >= b) {
|
|
if(a >= c) {
|
|
dayin("最大值是:" + a);
|
|
}else {
|
|
dayin("最大值是:" + c);
|
|
}
|
|
}else {
|
|
if(b >= c) {
|
|
dayin("最大值是:" + b);
|
|
}else {
|
|
dayin("最大值是:" + c);
|
|
}
|
|
}
|
|
}
|
|
public static void dayin(String zifuchuan) {
|
|
System.out.println(zifuchuan);
|
|
}
|
|
}
|