问答详情
源自:3-3 Java中的赋值运算符

(初学者)为什么按自己最笨的方法能运行但是答案是错的啊~

public class HelloWorld{

    public static void main(String[] args) {

    int one = 10 ;

        int two = 20 ;

        int three = 0 ;

        int s1 = one+two;

        System.out.println("three = one +two==>"+s1);

        int s2 =three+one;

        System.out.println("three += one ==>"+s2);

        int s3 =three-one;

        System.out.println("three -= one ==>"+s3);

        int s4 =three*one; 

        System.out.println("three *= one ==>"+s4);

        int s5 = three/one;                 

        System.out.println("three /= one ==>"+s5);

        int s6 = three%one;

        System.out.println("three %= one ==>"+s6);

}

}


提问者:慕粉0727548769 2019-07-22 21:55

个回答

  • qq_慕雪5397310
    2019-07-23 11:47:13
    已采纳

    代码没问题,应该是没看清楚题目要求吧

  • 慕粉0727548769
    2019-07-23 10:39:15

    答案显示和题目不一样... 我的运行之后是30 10 -10 0 0 0

  • 慕粉1524508109
    2019-07-23 08:29:32

    答案没有错啊

  • 慕先生9115901
    2019-07-23 08:26:46

    哪儿错了?你想要什么答案?