<> Zero , Single choice

* If so a=3, Then execute the following statement a The value of is ? a+=a*=a;
A. 3
B. 12
C. 9
D. 18
answer :B
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 ?
A. n/10%2
B. (n-n%10)/100
C. n%10
D. n%100/10
answer :D

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 ?
A. /
B. \
C. %
D. *
answer :A
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="
+x+","); System.out.println("y="+y);
A. x=11,y=11
B. x=10,y=11
C. x=10,y=12
D. x=12,y=10

answer :A

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);
A. 333
B. 334
C. 234
D. 233

answer :C
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;
A. c=c+i;
B. s+=i;
C. i+=s;
D. c+=s;

answer :B
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 .

Technology
©2019-2020 Toolsou All rights reserved,
ToastUtils Use of SpringMVC Frame in controller Layer gets the property value of the custom configuration file ajax get Request Chinese parameter garbled solution ELementUI select Multi select drop-down box to get all properties of the selected item Maximum security risk of cloud computing : Unclear safety responsibility python in switch_to_alert Usage of fio Use details Ai Wei also talks about project management , On grass roots management Android 11 Official release !( Essence )2020 year 7 month 15 day Wechat applet import and include difference