JAVA 笔试题
C
. int number=[]={31,23,33,43,35,63}
D
. 数组的大小可以任意改变
10、不能用来修饰 interface
的有( )
A.private B.public C.protected D.static
11、关于 Float
,下列说法正确的是
A.Float
是一个类
B.Float 在 java.lang
包中
C.Float a=1.0
是正确的赋值方法
D.Float a= new Float(1.0)
是正确的赋值方法
12
、下列哪种说法是正确的( )
A
. 实例方法可直接调用超类的实例方法
B
. 实例方法可直接调用超类的类方法
C
. 实例方法可直接调用其他类的实例方法
D
. 实例方法可直接调用本类的类方法
13
、下列说法错误的有( )
A.在类方法中可用 this 来调用本类的类方法
B.在类方法中调用本类的类方法时可直接调用
C.在类方法中只能调用本类中的类方法
D.在类方法中绝对不能调用实例方法
14
、下面说法哪些是正确的?
A.Applet
可以访问本地文件
B.对 static
方法的调用不需要类实例
C.socket 类在 java.lang
中
D.127.0.0.1
地址代表本机
15、类 Test1、Test2 定义如下:
1. public class Test1 {
2. public float aMethod(float a, float b) throws
3. IOException { }
4. }
5. public class Test2 extends Test1 {
6. //Line6
7. }
将以下()方法插入行 6
是不合法的。
A. float aMethod (float a, float b) {}
B. public int aMethod (int a, int b) throws Exception {}
C. public float aMethod (float P, float q) {}
D. public int aMethod (int a, int b) throws IOException {}
16、关于以下程序段,正确的说法是:()
1. String s1 = “abc” + “def”;
2. String s2 = new String(s1);
3. if(s1.equals(s2))
4. System.out.println(“.equals() succeeded”);
5. if(s1 == s2)
6. System.out.println(“== succeeded”);
第 2
页 共 8 页