為什么我這個報錯a
public class HelloWorld{
? ? public static void main(String[] args) {
? ?int one = 10 ;
? ? ? ? int two = 20 ;
? ? ? ? int three = 0 ;
? ? ? ??
? ? ? ? int one = 10;
? ? ? ? int two = 20;
? ? ? ? int three = 0;
? ? ? ? three = one + two;
? ? ? ? System.out.println("three = one + two ==>"+three);
? ? ? ? three +=one;
? ? ? ? System.out.println("three += one ?==>"+three);
? ? ? ? three -=one;
? ? ? ? System.out.println("three -= one ?==>"+three);
? ? ? ? three *=one;
? ? ? ? System.out.println("three *= one ?==>"+three);
? ? ? ? three /=one;
? ? ? ? System.out.println("three /= one ?==>"+three);
? ? ? ? three %=one;
? ? ? ? System.out.println("three %= one ?==>"+three);
? ??
}
}
2021-05-29
第7、8、9行前面已經不該有int,前面已經定義了。刪除這三行,或者刪除int即可。