问题描述:
Supose x=2 and y=3,Show the output.
程序代码:
import java.util.Scanner;
public class question {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("please input x:");
int x = input.nextInt();
System.out.print("please input y:");
Scanner input1 = new Scanner(System.in);
int y = input1.nextInt();
if (x > 2)
{
if (y > 2) {
int z = x + y;
System.out.print("z is " + z);
}
}
else
System.out.print("x is " + x);
}
}
运行结果: