




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、(单选题)下列数组声明语句中,错误的是:()2 A.int口 arr = new int。;?B.int arr = new int口;?C.int arr = ;?D.int arr = new int2口;正确答案:B2.(单选)class Card 下列不属于Card类构造方法的是:()2 A.Card()?B.public Card()?C.public void Card()。?D.private Card()。3.正确答案:C(单选)下面不属于Java语言特点的是:2 A.平台无关?B.面向对象?C.支持指针类型?D.垃圾回收机制正确答案:C4.(单选)下列选项中的类,能正确实现
2、java.lang.Runnable 接口和java.lang.Clonable 接 口的是()。2 A.public class Session implements Runnable, Clonable public void run(); publicObject clone(); ?B.public class Session implements Runnable, implements Clonable public void run() / do something */ public Object clone() / make a copy */ ?C.public class
3、 Session implements Runnable, Clonable public void run() / dosomething */ public Object clone() /* make a copy */ ?D.public class Session extends Runnable, Clonable public void run() ; public Objectclone(); 正确答案:C5.(单选)下列属于不合法Java标识符的是()?A.mem?B.12a?C.M12?D.$12正确答案:B6.(单选)下列Java标识符,错误的是()2 A._sys_va
4、rl?B.$change?C.User_name?D.Ifile8.正确答案:D(单选Java程序的执行过程中用到一套JDK工具,其中javac.exe是指()。2 A.Java语言编译器?B.Java字节码解释器?C.Java文档生成器?D.Java类分解器9.正确答案:A(单选)运行下列代码:int口 oneArr = 2, 11, 26, 27, 37, 44, 48, 60 ; int口 twoArr= 19, 35, 49, 55, 58, 75, 83, 84, 91, 93 ; int口 threeArr = new intoneArr.length+ twoArr.length
5、; int p = 0, q = 0; while(p oneArr.length & q twoArr.length) threeArrp + q = oneArrp twoArrq ? oneArrp+ : twoArrq+; if (p oneArr.length) System.arraycopy(oneArr, p, threeArr, p + q, oneArr.length -p); else if (q 1;?D.byte bl = 10; byte b=+b1;正确答案:D12.(单选)类 Super 及 Sub定义如下:public class Super private
6、void f() System.out.println(Super.f(); public void g() f(); public void k() f(); public class Sub extends Super private void f() System.out.println(Sub.f(); public void k() f(); 运行下列语句Super obj = new Sub(); obj.g(); obj.k();输出的结果是:()。?A.Sub.f() Sub.f()?B.Sub.f() Super.f()?C.Super.f() Sub.f()?D.Super
7、.f() Super.f()正确答案:C13.(单选)关于下列代码说法正确的是: class ClassA public int numberOfinstances;voidprotected ClassA(int numberOfinstances) this.numberOfinstances = numberOfinstances; public class ExtendedA extends ClassA private ExtendedA(int numberOfinstances) super(numberOfinstances); public static main(Strin
8、g口 args) ExtendedA ext = new ExtendedA(420);System.out.print(ext.numberOfinstances); ?A.运行后,输出420?B.运行时抛出异常?C.编译错误,所有的构造器必须是 public的?D.编译错误,构造器不能是private的正确答案:A14.(单选)关于下列代码说法正确的是:public class A private int counter = 0; publicstatic int getInstanceCount() return counter; public A() counter+; public
9、static void main(String口 args) A a1 = new A(); A a2 = new A(); A a3 = new A();System.out.println(A.getInstanceCount(); ?A.该类编译失败?B.输出:1?C.输出:3?D.输出:0正确答案:A15.(单选)下面for语句,存在编译错误的是()2 A.for( ; ; )?B.for(int i=0; i 0) ? elements。 : null; System.out.println(first); ?A.编译出错输出:tea?B.?C.输出:for?D.输出:null正确答
10、案:C25.输出的结果是:()o(单选)运行下面的程序: int a = 100; int b = 200; a = a + b; b = a - b; a = a - b; System.out.println(a= + a + , b= + b);?A.a=100, b=300a=100, b=200a=200, b=100?B.?C.?D.a=300, b=200正确答案:C26.(单选)下列关于JVM说法,错误的是()2 A.JVM通过专门的线程实现内存的回收?B.使用java命令时,可以通过参数来设置分配 JVM的内存大小。?C.JRE包括JVM及Java核心类库。?D.目前主流版本
11、JVM过纯解释白方式运行Java字节码正确答案:D27.(单选)请看下歹U代码:interface Data public void load(); abstract class Info public abstract void load(); 下列选项中,能正确使用 Data接口和Info类的是()?A.public class Employee extends Info implements Data public void load() /*dosomething*/ ?B.public class Employee implements Info extends Data publi
12、c void load() /*do something*/ ?C.public class Employee implements Info extends Data public void Data.load() /*d something */ public void load() /*do something */ ?D.public class Employee extends Info implements Data public void load() /*dosomething */ public void Info.load() /*do something*/ 正确答案:A
13、28.(单选)类 A, B 的定义如下: class A private int a = 100; A() System.out.print(A()”); System.out.println(a); class B extends A private int a = 200; B() System.out.print(B(); System.out.println(a); 运行下面的代码:new B();输出的结果是:()。2 A.A() 100 B() 200?B.A() 200 B() 200?C.B() 200 A() 100?D.B() 200 A() 200正确答案:A29.(单选
14、)如下方法声明中,错误的是()2 A.public void say() System.out.print(“Hi”); ?B.public void say() System.out.print(“Hi ); return; ?C.public int say() System.out.print(“Hi ); return; ?D.public int say() System.out.print(“Hi ); return 0; 正确答案:C30.(单选)下列代码编译和运行的结果是()。 public class A public void start() System.out.prin
15、tln(TestA); public class B extends A public void start() System.out.println(TestB); public static void main(String口args) (A) newB().start(); 输出:TestA2 A.?B.输出:TestB?C.输出:TestA TestB?D.编译错误正确答案:B31.(单选)下列代码的运行结果是:public class GoTest public static void main(String口args) Sente a = new Sente(); a.go();
16、Goban b = new Goban(); b.go(); Stone c =new Stone(); c.go(); class Sente implements Go public void go() System.out.println(go in Sente); class Goban extends Sente public voidgo() System.out.println(go in Goban); class Stone extends GobanimplementsGo interface Go public void go(); ?A.go in Goban go i
17、n Sente go in Sente?B.go in Sente go in Sente go in Goban?C.go in Sente go in Goban go in Goban?D.go in Goban go in Goban go in Sente(单选)程序的执行结果是()。 public class Test int x; public static voidmain(String 口 args) Test t = new Test(); t.x=5; change(t);System.out.println(t.x); public static void change
18、(Test t) t.x=3; ?A.5?B.3?C.0?D.正确答案:B33.(单选)分析如下语句,说法错误的是()2 A.break可用于跳出循环,当多层嵌套时,只用于跳出一层循环?B.break即可以出现在循环语句中也可以出现在switch语句中?C.continue可以用于跳出循环?D.continue不能出现在switch语句中正确答案:C43.(单选)请看下歹U代码编译和运行的结果是:package packagea; public class Message String getText() return text; package packageb; public class
19、XMLMessage extends packagea.Message String getText() return text”; public static void main(String口 args) System.out.println(newXMLMessage().getText(); ?A.text?B.text?C.抛出运行时异常?D.代码 public class XMLMessage extends packagea.Message 行, 编译错误正确答案:B35.(单选)程序执行的结果是()。 public class Test String name=Tom; pub
20、licTest(String name) name=name; public static void main(String 口 args) Test t=new Test(Jack); System.out.println(); ?A.null?B.Tom?C.Jack?D.正确答案:B36.(单选)请看下列代码的输出结果是:public class Bootchy int bootch; String snootch;public Bootchy() this(snootchy); System.out.print(first ); publicBootchy(String s
21、nootch) this(420, snootchy); System.out.print(second ); public Bootchy(int bootch, String snootch) this.bootch = bootch; this.snootch =snootch; System.out.print(third ); public static void main(String口 args) Bootchy b = new Bootchy(); System.out.print(b.snootch + + b.bootch); ?A.first second third s
22、nootchy 420?B.third second first snootchy 420?C.third first second snootchy 420?D.first second first third snootchy 420正确答案:B37.(单选)下列代码的输出结果是:()。 public class StaticFoo int num; static int x; public static void main(String口 args) StaticFoo fool = new StaticFoo ();foo1.num+; foo1.x+; StaticFoo foo2
23、= new StaticFoo (); foo2.num+; foo2.x+;StaticFoo foo3 = new StaticFoo (); foo3.num+; foo3.x+; StaticFoo.x+;System.out.print(foo3.num+,); System.out.println(foo3.x); ?A.3,3?B.1,3?C.3,4?D.1,4正确答案:D38.(单选)请看下列程序的输出结果是:public class Item private String desc; publicString getDescription() return desc; pub
24、lic void setDescription(String d) desc = d; public static void modifyDesc(Item item, String desc) item = newItem(); item.setDescription(desc); public static void main(String口 args) Item it = new Item(); it.setDescription(Gobstopper); Item it2 = new Item();it2.setDescription(Fizzylifting); modifyDesc
25、(it, Scrumdiddlyumptious);System.out.println(it.getDescription();System.out.println(it2.getDescription(); ?A.Scrumdiddlyumptious Scrumdiddlyumptious?B.Scrumdiddlyumptious Fizzylifltng?C.Gobstopper Scrumdiddlyumptious?D.Gobstopper Fizzylifting正确答案:D39.(单选)下面的代码用于对数组 arr实现冒泡排序:for (int i = 0; i i; j-)
26、 if (arrj 0; j-) if (arrj arrj - 1) int temp = arrj; arrj = arrj - 1; arrj - 1 = temp; isSwap = true; ?C.for (int j = i + 1; j arr.length; j+) if (arrj arrj - 1) int temp =arrj; arrj = arrj - 1; arrj - 1 = temp; isSwap = true; ?D.for (int j = i; j arr.length; j+) if (arrj arrj - 1) int temp = arrj;a
27、rrj = arrj - 1; arrj - 1 = temp; isSwap = true; 正确答案:A40.(单选)请看下歹U代码:class Payload private int weight; public Payload(int wt) weight = wt; public Payload() public void setWeight(int w) weight = w; public String toString() return Integer.toString(weight); public class TestPayload static void changePa
28、yload(Payload p) public staticvoid main(String args) Payload p = new Payload(); p.setWeight(1024);changePayload(p); System.out.println(The value of p is + p); 假设运行后输出“The value of p is 420,那么 插入代码处应填入代码是:?A.p.setWeight(420);?B.Payload.setWeight(420);?C.p = new Payload(420);?D.p = new Payload(); p.se
29、tWeight(420);41. returnRaceCar+ .正确答案:A(单选)下列代码的输出结果是()。abstract class Vehicle public int speed() 0; class Car extends Vehicle public int speed() return 60; class extends Car public int speed() return 150; public class TestCar public static void main(String口 args) RaceCar racer = new RaceCar(); Car
30、car = new RaceCar(); Vehicle vehicle = new RaceCar(); System.out.println(racer.speed() + car.speed() + , + vehicle.speed(); 0, 0, 02 A.?B.150, 60, 0?C.150, 150, 150?D.抛出运行时异常正确答案:C42.(单选)题目:下列代码的输出结果是:()。public class A public voidinfo() System.out.println(A info); public class B extends A public voi
31、dinfo() System.out.println(B info); public static void main(String口 args) B b=new B(); A a=b; (); ?A.B info A info?B.A info B info?C.A info?D.B info正确答案:D43.(单选)请看下列代码:class ClassA class ClassB extends ClassA class ClassCextends ClassA public class Test public static void main(String口 args) Cl
32、assA p0 = new ClassA(); ClassB p1 = new ClassB(); ClassC p2 = new ClassC(); ClassA p3=new ClassB(); ClassA p4 = new ClassC(); 插入代码 可以在 插入代码处,填入的代码正确的是()?A.p0 = p1;?B.p1 = p2;?C.p2 = p4;?D.p2 = (ClassC)p1;正确答案:A44.(单选)下列代码的运行结果是()。public class Animal public String noise() return peep; public static v
33、oid main(String口 args) Animal animal = new Dog(); Catcat = (Cat)animal; System.out.println(cat.noise(); class Dog extends Animal public String noise() return bark; class Cat extends Animal public String noise() return meow; ?A.peep?B.bark?C.meow?D.抛出运行时异常正确答案:D45.(单选)类 A, B 和 C 的定义如下: public class A
34、 public void f() System.out.println(A.f(); public class B extends A public void f() System.out.println(B.f(); public class C public void g(A a) System.out.println(g(A a); a.f(); public void g(B b) System.out.println(g(B b); b.f(); 运行下面程序:C c = new C(); A a = newB(); c.g(a);输出的结果是:()。?A.g(A a) A.f()?
35、B.g(A a) B.f()?C.g(B b) A.f()?D.g(B b) B.f()正确答案:B46.(多选)请看下歹U代码:package com.tarena; public class Geodetics public staticfinal double DIAMETER = 12756.32; 访问静态常量 DIAMETER:方式正确的是:?A.import com.tarena.Geodetics; public class TerraCarta public doublehalfway() return Geodetics.DIAMETER/2.0; ?B.import com.tarena.Geodetics; public class TerraCarta publ
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 物第十章浮力单元试卷 2024-2025学年人教版物理八年级下册
- 2024年纺织品检验员考试注意事项试题及答案
- 土壤普查试题答案及解析
- 山东会计综评试题及答案
- 社区建设考试试题及答案
- 必修四 测试题及答案
- 助理广告师考试中广告交流策略的深入分析试题及答案
- 广告设计师广告效果测评试题及答案
- 管理会计试题卷及答案
- 强化实践国际商业美术设计师考试试题及答案
- 2024年研发部规划
- 《冠心病》课件(完整版)
- 失业保险待遇申领表
- 销售提成及职能部门员工利润分红方案
- 药用植物学智慧树知到答案2024年浙江中医药大学
- 评职称业绩合同协议书
- 广东省佛山2022-2023学年外研版八年级下学期英语期末模拟试卷(二)
- 四年级《爷爷的爷爷从哪里来》阅读测评题
- 2020-2024年安徽省初中学业水平考试中考英语试卷(5年真题+答案解析)
- 2024年福建省泉州市中考二模地理试题
- 2024年重庆八中中考数学一模试卷
评论
0/150
提交评论