- 1
- 0
- 约4.01千字
- 约 4页
- 2023-08-29 发布于湖北
- 举报
XX公司 JAVA笔试
选择题
1,下列哪个单词不是java关键字( )
A. native B. goto C. volatile D. transient
2,abstract的method可以同时是以下哪种( )
A. static B. synchronized C. native D. protected
3,以下哪句是错误的( )
A. 接口可以继承接口
B. 一个接口可以继承多个接口
C. 一个类可以实现多个接口
D. 一个类可以继承多个类
4,下面哪个结果正确( )
public class MyProgram{
1 public static void main(String[] args){
2 try{
3 System.out.println(“hello”);
4 throw new RuntimeException(“throw”);
5 System.out.println(“world”);
6 }catch (Exception e){
7 System.out.println(“catch”);
8 }
9 }
}
A. 第4行编译错误 B. 第5行编译错误
C. 输出:hello throw world catch D. 输出:hello throw catch
5,下面哪个结果正确( )
public class Stepper{
enum Roman{I, V, X, L , C, M}
public static void main(String[] args){
int x = 6;
int z = 2;
Roman r = Roman.X;
do{
switch ( r ){
case C: r = Roman.L;break;
case X: r = Roman.C;
case L: if(r.ordinal()3)z+=5;
case M: x++;
}
z++;
x++;
}while(x15);
System.out.println(z);
}
}
A. 编译错误 B. 11 C. 12 D. 27
6,下面哪个结果正确( )
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Sortee{
public static void main(String[] args){
ListIntegerx = new ArrayListInteger();
x.add(5);
x.add(new Integer(42));
x.add(new Integer(“17”
x.add(Integer.parseInt(‘812”
Collectiongs.sort(x);
System.out.prinln(x);
}
}
A. 编译错误 B. 运行的时候会抛出异常 C. [5,42,17,812] D. [5,17,42,812]
7,下面哪个结果正确( )
public class Child extends Father{
private Child(){
System.out.print(“Child”);
}
public sta
原创力文档

文档评论(0)