1.下列哪个选项是合法的标识符? 24
A.123
B._name
C.class
D.1first
2.下列变量定义中,正确的是1
A long 1 = 123L
B long 1 = 3.14156f
C int i="k"
D double = 1.55989E2f
3.switch语句中表达式(expression)的值不允许用的类型是124
A byte
B int
C Boolean
D char
4.下列语句中正确的是?3
A S ystem.out.pritln(1+’1’);
B int I=2+’2’;
C string s =”on”+’one’;
D byte b=257
5.下列的哪个赋值语句是不正确的? 12
A.float f = 11.1;
B.double d = 5.3E12;
C.float d = 3.14f ;
D.double f=11.1E10f;
6.下列的哪个赋值语句是正确的? 2
A.char a=12;
B.int a=12.0;
C.int a=12.0f;
D.int a=(int)12.0;
7.给出下列的代码,哪行在编译时可能会有错误? 13
① public void modify(){
② int i, j, k;
③ i = 100;
④ while ( i > 0 ){
⑤ j = i * 2;
⑥ System.out.println (" The value of j is " + j );
⑦ k = k + 1;
⑧ }
⑨ }
A.line 4
B.line 6