为了账号安全,请及时绑定邮箱和手机立即绑定

对否?为什么输出不对提交可以通过?

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


正在回答

1 回答

        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是自定义输出的

0 回复 有任何疑惑可以回复我~
#1

阿斯arth 提问者

非常感谢!
2015-06-16 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

对否?为什么输出不对提交可以通过?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信