public class Sum { public static void main(String[] args) { int sum = 0; number1 = 1; number2 = 2; sum = number1 + number2; { System.out.println("sum"); } }}代码有什么问题
RISEBY
浏览 602回答 2
2回答
哆啦的时光机
你应该给 number1 和number2像sum那样 给他们定义为int类型 int number1 int number2 代码如下public class Sum {public static void main(String[] args) {int sum = 0;int number1 = 1;int number2 = 2;sum = number1 + number2;{System.out.println("sum = " + sum);}}}