public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入加数");
String s = sc.next();
System.out.println("请输入被加数");
String s1 = sc.next();
int x = Integer.parseInt(s);
int y = Integer.parseInt(s1);
int z = 0;
z = x + y;
System.out.println("x+y = " + z);
}
}
刚刚给你写的,里面的运算你可以按照你的意思改。