文档介绍:1 阅读下列代码段:
Int i=3, j ;
Outer : while (i>0)
{
J=3 ;
Inner:while (j>0)
{
If (j<2) break inner;
(j+”and”+i) ;
j-- ;
}
i -- ;
}
下列哪一项将不会被输出到屏幕上?
A ) 3and3 B) 3and2 C) 3and1 D)3and0
2. 如果要抛出异常,应该采用的子句是----------
A) catch B) throw C) try D) finally
:
Public class person
{
Int arr [ ]= new int [10];
Public static vond main (string a[ ])
{
(arr[1]);
}
}
执行结果正确的说法是------------。
A) 编译时将产生错误 B) 编译时正确,运行时将产生错误
C) 输出零 D) 输出空
:
Public class Test
{
Public static void main (string args [ ])
{
Char ch ;
Switch (ch)
{
Case ‘a’: (“abc”);break;
Case’b’: (“ab”);
Case’c’: (“c”);break;
Default: (“abc”);
}
}
}
不输出”abc”的ch值是-----------。
A)’a’ B) ‘b’ C) ‘c’ D) ‘d’
For (int x=0;x <15; x+=2) sum+=x+5;
作用一样的语句是--------------。
A) for (int x =5; x<20;x+=2)sum+=x;
B) for(int x=5;x<20;x+=x-2)x+=2;
C) for(int x=0;x<15;x+=2)sum+=x+3;x+=2;
D) 上述全对
6. 阅读下列代码:
Public class Test{
Public static void mian ( String args[] ) {
Float a=, b=, c=;
String s=””;
(a+b+s+c);
();
}
}
程序运行结果为________.
A) absc B)
C) D)
7. 阅读下列代码:
Public class Test{
Public static void main ( String args[] ) {
String s1= new String(“hello”);
Stirng s2= new String(“hello”);
Stirng s3= s1;
( s1 = =s2 );
( s1 = = s3 );
}
}
程序运行结果为_________.
A) true,false B) true,true C) false,true D) false,false
8. 下面运算符中优先级最高的是_________.
A) >> B) * C) && D) +=
9. 阅读下列代码:
Public class Test{
Public static void main ( String args[] ) {
int a = 10,b = 6;
(a & b );
}
}
程序运行结果为_________.
A) 2 B) 6 C) 10 D) 16
10 和语句
y=x+7;
x++;
While (x<9)
{
y=x+7;
x++;
}
执行结果相同的语句是------------
A) y=x+7;
x++;
do{
y