請(qǐng)問我這樣寫代碼哪里不對(duì)?
public class HelloWorld{
? ? public static void main(String[] args) {
? ?int one = 10 ;
? ? ? ? int two = 20 ;
? ? ? ? int three = 0 ;
? ? ? ? int num1=one+two;
? ? ? ? int num2=three+=one;
? ? ? ? int num3 =three-=one;
? ? ? ? int num4 =three*=one;
? ? ? ? int num5 =three/=one;
? ? ? ? int num6 =three%=one;
? ? ? ? System.out.println("three = one + two ==>"+num1);
? ? ? ? System.out.println("three = one += two ==>"+num2);
? ? ? ? System.out.println("three = one -= two ==>"+num3);
? ? ? ? System.out.println("three = one *= two ==>"+num4);
? ? ? ? System.out.println("three = one /= two ==>"+num5);?
? ? ? ? System.out.println("three = one %= two ==>"+num6); ? ??
? ? }
}?
2017-09-23
一條語句中不可有兩個(gè)賦值符號(hào)
2017-09-23
public class HelloWorld{
? ? public static void main(String[] args) {
? ?int one = 10 ;
? ? ? ? int two = 20 ;
? ? ? ? int three = 0 ;
? ? ? ? System.out.println(three = one + two );
? ? ? ? System.out.println(three = one += two );
? ? ? ? System.out.println(three = one -= two );
? ? ? ? System.out.println(three = one *= two);
? ? ? ? System.out.println(three = one /= two);?
? ? ? ? System.out.println(three = one %= two ); ? ??
? ? }
}?