<> Zero , Single choice
* If so a=3, Then execute the following statement a The value of is ? a+=a*=a;
analysis ： Reference analytic assignment is performed from right to left , so a=a*a=9,a+=9,a=a+9=3+9=12
* For a three digit positive integer n=789, The following results are 8 Yes ?
analysis : The comprehensive application of operator in this question ,/ Is the division operator ,% Is the remainder operator , The result is the remainder after division .A option ,n/10=78,78%2=0,n/10%2 The result is ：0;B option ,n-n%10=780,(n-n%10)/100 The result is ：7;C option ,n%10 The result is ：9;D option ,n%100=89,89/10=8,n%100/10 The result is ：8. therefore ,D The option is correct .
* In the following operator , Which is used to perform the division operation ?
analysis ： This question examines the operator ,A option / Division is used to perform the operation , therefore A The option is correct .B Option is not Java operator .C Option is the operator for the remainder . D The option is a multiplication operator .
* The output of the following code is ? int m=5,n=6; int x=(m+n)+n; int y=(--m)+n; System.out.print("x="
analysis ： This question examines the self increasing and decreasing operators ,A The option is correct .m++ Is to participate in the operation first and then add , therefore x=(m++)+n=5+6=11; After assignment m=6,–m First self subtraction, then participate in the operation , therefore y=(–m)+n=11, After assignment m=5. so x=11,y=11.
5. The output of the following block is ：
int a=2; System.out.print(a++); System.out.print(a); System.out.print(++a);
analysis ： This question examines the self increasing and decreasing operators .a++ Is to participate in the operation first and then add , So the first output 2, Second output 3,++a It is self adding first and then participating in the operation , So the third output 4. therefore ,C The option is correct .
* The following variables are set , Which of the following statements compile without errors ? char c='c'; int i=10; double d=10; long l=1; String s=
"Hello"; int a=2;
analysis ： An examination of this question + operator , When the string is added to the basic data type data , It's actually string concatenation . as ：String s=“Hello”+1;
be s The value of is "Hello1".A option ,c It is character data ,i by int Type variable ,c+i Subsequent results cannot be assigned to character variables ;C option ,i+=s; amount to i=i+s;
i by int Type variable ,s by String Type variable ,i+s The results are as follows String type ,String Type cannot be assigned to int Type variable ;D option ,c+=s; amount to c=c+s;
c Is a character variable ,s by String Type variable ,c+s The result is String type ,String Type cannot be assigned to a character variable ;B option ,s+=i; amount to s=s+i;
i Is an integer variable ,s Is a string variable ,s+i The result of is a string type , Can be assigned to a string type variable . therefore B The option is correct .