中兴Java 笔试题

一、选择题(每题4分,共80分)

编译Java Application 源程序文件将产生相应的字节码文件,这些字节码文件的扩展名为( )

A. .java B. .class

C. .html D. .exe

main方法是Java Application程序执行的入口点,关于main方法的方法头以下哪项是合法的( )

A. public static void main()

B. public static void main( String args[] )

C. public static int main( String [] args )

D. public void main( String args[] )

下面哪个是short型的取值范围:( )

A. -27 -- 27-1 B. 0 -- 216-1

C. -215 -- 215-1 D. -231 -- 231-1

以下哪项关键字能够作为Interface内定义的Method的修饰符?( )

A. public B. final

C. abstract D. protected

一个函数定义的返回值是float,它不能在return语句中返回的值的类型是

A. char B. float

C. long D. double

下面哪项是不合法的标识符:( )

A. $persons B. TwoUsers

C. *point D. _endline

下面不属于JAVA关键字的是( )

A. instanceof B. finally

C. sizeof D. volatile

下面程序的输出为

public class ArrayTest{
public static void main (String[] args){
????Object[] ov;
????String[] sa = { "Green", "Blue", "Red" };
????ov = sa;
????System.out.println("Color=" + ov[1]);
}
}

A. 存在编译错误. 输出Color=Blue. 输出Color=Green. 运行时抛出异常

字符串t中的字符为

String s = "hypertext";

String t = s.substring(2, 5);

A. "yper" B. "ype"

C. "pert" D. "per"

有如下程序,请选择一个正确的结果( )

class Superclass { }
class Subclass extends Superclass { }
Superclass a = new Superclass();
Subclass b = new Subclass();

选择一个正确的来解释下面的语句 = a;

A. 编译非法 编译正确,但运行时可能非法 运行时正确 public class Parent

{

public int addValue( int a, int b) { return a+b; }
}
class Child extends Parent
{ }
int addValue( int a, int b ){// do something...}
public void addValue (){// do something...}
public void addValue( int b, int a ){// do something...}
public int addValue( int a, int b )throws MyException {//do something...}

以下那些判断会返回 false( )

String a = “Hello”;

String b = “Hello”;

String c = new String(“Hello”);

a.equals(b);

a == b;

a == c;

c.equals(“Hello”);

对于以下的方法体,如果TimedOutException直接继承Exceptio