文档介绍:郑州世纪创联java笔试题(时间:50分钟)
姓名: 联系电话: 分数:
选择题(2*10分)
1. 下面哪些是Thread类的方法( )
A、run( ) B、start( ) C、notify() D、getPriority()
2. 下面程序运行结果是( )
public static void main(String[] args){
String str1="hello";
String str2="he"+new String("llo");
String str3=str1;
(str1==str2);
(str1==str3);
}
A、true true B、false false C、flase true D、true flase
3. 下列说法正确的有( )
A、 class中的constructor不可省略
B、 constructor必须与class同名,但方法不能与class同名
C、 constructor在一个对象被new时执行
D、一个class只能定义一个constructor
4. 下面程序运行结果是( )
public static void main(String[] args){
Thread t=new Thread (){
public void run (){
hello();
};
t. run ();
(“world”);
}
static void hello(){
(“hello”);
}
hello world B、word C、world hello D、都不输出
( )
A、Double B、Fload C、double D、fload
6. getCustomerInfo()方法如下,try中可以捕获三种类型的异常,如果在该方法运行中产生了一个IOException,将会输出什么结果( )
public void getCustomerInfo() {
try {
// do something that may cause an Exception
} catch ( ex) {
("FileNotFoundException!");
} catch ( ex) {
("IOException!");
} catch ( ex) {
("Exception!");
}
A 、IOException!
B、IOException!Exception!
C、FileNotFoundException!IOException!
D、FileNotFoundException!IOException!Exception!
7.  Java接口的修饰符可以为( )