package com.ty.java;
public class Hello{
public static void hello(int a,int b,int c){
if(a>b){ //用if语句将其分成两种情况:a>b 和 a<b
if(a>c){
System.out.println(a); //在两种情况分别用if语句嵌套
}
else{
System.out.println(c);
}
}
else{
if(b>c){
System.out.println(b);
}
else{
System.out.println(c);
}
}
}
}
下面是引用
例如:a=2,b=3,c=5
package com.ty.test;
import com.ty.java.Hello;
public class Test {
public static void main(String[] args) {
Hello.hello(2,3,5);
}
}
运行如下:
5
Process finished with exit code 0