森森0515
2019-09-04 21:40
three = one+ two; //为啥前面加上int数据类型就运行不了了呢?
public class HelloWorld{
public static void main(String[] args) {
int one = 10 ;
int two = 20 ;
int three = 0 ;这个地方已经有定义了three变量
three=one+two;所以在这里加int会出现报错
//
error: variable three is already defined in method main(String[]) int three=one+two;
//
System.out.println(" three = one + two==> "+three);
three=three+one;
System.out.println(" three += one ==> "+three);
three=three-one;
System.out.println(" three -= one ==> "+three);
three=three*one;
System.out.println(" three *= one ==> "+three);
three=three/one;
System.out.println(" three /= one ==> "+three);
three=three%one;
System.out.println(" three %= one ==> "+three);
}
}
Java入门第一季(IDEA工具)升级版
1165561 学习 · 17587 问题
相似问题