阿斯arth
2015-06-14 19:36
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
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是自定义输出的
Java入门第一季(IDEA工具)升级版
1165551 学习 · 17586 问题
相似问题