對否?為什么輸出不對提交可以通過?
public class HelloWorld{
? ? public static void main(String[] args) {
? ?int one = 10 ;
? ? ? ? int two = 20 ;
? ? ? ? int three = 0 ;
? ? ? ? three = one + two ==>30;
? ? ? ? three += one ==> 40;
? ? ? ? three -= one ==> 30;
? ? ? ? three *= one ==> 300;
? ? ? ? three /= one ==> 30;
? ? ? ? three %= one ==> 0;
? ? ? ? System.out.println("three = one + two ==>" + three);
? ? ? ? System.out.println("three += one ==> "+ three);
? ? ? ? System.out.println("three -= one ==> "+ three);
? ? ? ? System.out.println("three *= one ==> "+ three);
? ? ? ? System.out.println("three /= one ==> "+ three);
? ? ? ? System.out.println("three %= one ==> "+ three);}}
? ? ? ? 為什么輸出不對呢
? ? ? ?error: illegal start of expression
three = one + two ==>30;
^
error: illegal start of expression
three += one ==> 40;
^
error: illegal start of expression
three -= one ==> 30;
^
error: illegal start of expression
three *= one ==> 300;
^
error: illegal start of expression
three /= one ==> 30;
^
error: illegal start of expression
three %= one ==> 0;
^
6 errors
2015-06-14
????? ??three = one + two ==>30;
? ? ? ? three += one ==> 40;
? ? ? ? three -= one ==> 30;
? ? ? ? three *= one ==> 300;
? ? ? ? three /= one ==> 30;
? ? ? ? three %= one ==> 0;
這些代碼不對,語法不正確, 舉個例子說明一下:?three = one + two ==>30; ? 這一個是輸出結果,是自己拼接出來的,你只要通過計算得到正確結果就可以了。
three = one + two;
System.out.println("three = one + two ==>" + three); ?//three = one + two是自定義輸出的