请教:3-3 java中的赋值运算符
请问练习题代码怎么写?没看懂要求。
请问练习题代码怎么写?没看懂要求。
2017-07-14
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);
//他的意思就是输出那样的结果,上面这是代码片段public class HelloWorld{
public static void main(String[] args) {
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);
}
}
举报