import java.util.Scanner;
class Demo3 {
public static void main(String[] args)
{
Scanner sc = new Scanner (System.in);
System.out.println("请输入第一个整数:");
int x = sc.nextInt();
System.out.println("请输入第二个整数:");
int y = sc.nextInt();
int max = getMax(x,y);
System.out.println("max="+max);
}
public static int getMax(int a,int b) {
int max;
return max=a>b? a : b;
}
} |
|