




已阅读5页,还剩27页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
题目 以下代码 1 public class TestString1 2 public static void main String args 3 String str 420 4 str 42 5 System out print str 6 7 输出什么 以下代码 1 public class Test 2 public static void main String args 3 int x 5 4 boolean b1 true 5 boolean b2 false 6 7 if x 4 9 System out print 2 10 if b2 true 12 13 运行结果是什么 以下代码 22 public void go 23 String o 24 z 25 for int x 0 x 3 x 26 for int y 0 y 2 y 27 if x 1 break 28 if x 2 29 o o x y 30 31 32 System out println o 33 go 方法被调用后 产生什么结果 以下代码 10 int x 0 11 int y 10 12 do 13 y 14 x 15 while x 5 16 System out print x y 运行结果是 以下代码 1 public class Breaker 2 static String o 3 public static void main String args 4 z 5 o o 2 6 for int x 3 xdistance story 2 tail 7 System out print 1 8 if distance 1 tail story 2 distance 9 System out print 2 10 11 运行结果是 以下代码 1 import java util 2 public class Quest 3 public static void main String args 4 String colors 5 blue red green yellow orange 6 Arrays sort colors 7 int s2 Arrays binarySearch colors orange 8 int s3 Arrays binarySearch colors violet 9 System out print s2 s3 10 11 运行结果是 以下代码 1 class Alligator 2 public static void main String args 3 int x 1 2 3 4 5 6 7 8 9 4 int y x 5 System out print y 2 1 6 7 运行结果是 以下代码 1 public class Barn 2 public static void main String args 3 new Barn go hi 1 4 new Barn go hi world 2 5 6 public void go String y int x 7 System out print y y length 1 8 9 运行结果是 以下代码 5 class Atom 6 Atom System out print atom 7 8 class Rock extends Atom 9 Rock String type System out print type 10 11 public class Mountain extends Rock 12 Mountain 13 super granite 14 new Rock granite 15 16 public static void main String a new Mountain 17 运行结果是 以下代码 1 class X 2 X System out print 1 3 X int x 4 this 5 System out print 2 6 7 8 public class Y extends X 9 Y 10 super 6 11 System out print 3 12 13 Y int y 14 this 15 System out println 4 16 17 public static void main String a new Y 5 18 运行结果是 以下代码 1 public class A 2 public void doit 3 4 public String doit 5 return a 6 7 public double doit int x 8 return 1 0 9 10 运行结果是 以下代码 1 public class Base 2 public static final String FOO foo 3 public static void main String args 4 Base b new Base 5 Sub s new Sub 6 System out print Base FOO 7 System out print Sub FOO 8 System out print b FOO 9 System out print s FOO 10 System out print Base s FOO 11 12 13 class Sub extends Base public static final String FOO bar 运行结果是 以下代码 21 abstract class C1 22 public C1 System out print 1 23 24 class C2 extends C1 25 public C2 System out print 2 26 27 class C3 extends C2 28 public C3 System out print 3 29 30 public class Ctest 31 public static void main String a new C3 32 运行结果是 以下代码 1 public class KungFu 2 public static void main String args 3 Integer x 400 4 Integer y x 5 x 6 StringBuilder sb1 new StringBuilder 123 7 StringBuilder sb2 sb1 8 sb1 append 5 9 System out println x y sb1 sb2 10 11 运行结果是 1 class A 2 public String doit int x int y 3 return a 4 5 6 public String doit int vals 7 return b 8 9 给出以下代码 运行产生什么结果 25 A a new A 26 System out println a doit 4 5 以下代码 1 package test 2 3 class Target 4 public String name hello 5 可以直接访问和修改name变量值的是 以下代码 11 abstract class Vehicle public int speed return 0 12 class Car extends Vehicle public int speed return 60 13 class RaceCar extends Car public int speed return 150 21 RaceCar racer new RaceCar 22 Car car new RaceCar 23 Vehicle vehicle new RaceCar 24 System out println racer speed car speed 25 vehicle speed 运行的结果是 关于以下代码 5 class Building 6 public class Barn extends Building 7 public static void main String args 8 Building build1 new Building 9 Barn barn1 new Barn 10 Barn barn2 Barn build1 11 Object obj1 Object build1 12 String str1 String build1 13 Building build2 Building barn1 14 15 哪一个是正确的 以下代码 21 class Money 22 private String country Canada 23 public String getC return country 24 25 class Yen extends Money 26 public String getC return super country 27 28 public class Euro extends Money 29 public String getC return super getC 30 public static void main String args 31 System out print new Yen getC new Euro getC 32 33 运行结果是 以下代码 10 interface Foo 11 class Alpha implements Foo 12 class Beta extends Alpha 13 public class Delta extends Beta 14 public static void main String args 15 Beta x new Beta 16 insert code here 17 18 以下哪个代码插入第16行会抛出java lang ClassCastException异常 以下代码 31 class Foo 32 public int a 3 33 public void addFive a 5 System out print f 34 35 class Bar extends Foo 36 public int a 8 37 public void addFive this a 5 System out print b 38 通过以下调用 Foo f new Bar f addFive System out println f a 运行的结果是 Given 1 class TestA 2 public void start System out println TestA 3 4 public class TestB extends TestA 5 public void start System out println TestB 6 public static void main String args 7 TestA new TestB start 8 9 What is the result 以下代码 10 class Nav 11 public enum Direction NORTH SOUTH EAST WEST 12 13 public class Sprite 14 insert code here 15 以下哪个代码插入在14行 可以让Sprite class编译通过 以下代码 5 class Payload 6 private int weight 7 public Payload int w weight w 8 public void setWeight int w weight w 9 public String toString return Integer toString weight 10 11 public class TestPayload 12 static void changePayload Payload p insert code 13 public static void main String args 14 Payload p new Payload 200 15 p setWeight 1024 16 changePayload p 17 System out println p is p 18 哪个代码片段插入12行 使程序实行结果为420 以下代码 11 public static void test Sting str 12 int check 4 13 if check str length 14 System out print str charAt check 1 15 else 16 System out print str charAt O 17 18 通过下列调用 执行结果是什么 21 test four 22 test tee 23 test to 以下代码 15 public class Pass2 16 public static void main String args 17 int x 6 18 Pass2 p new Pass2 19 p doStuff x 20 System out print main x x 21 22 23 void doStuff int x 24 System out print doStuff x x 25 26 在命令行输入以下指令 产生什么结果 javac Pass2 java java Pass2 5 String s new String 1 String t new String 1 则执行语句System out println s t 的输出结果为 如果A类继承B类则下列哪个说法最可能是正确的 执行下列代码后变量a的值为 boolean a false boolean b false 下列java程序设计中编译错误的是 在类中入口方法main的写法正确的为 下列关于double long float类型可表示的数值范围的大小顺序正确的是 执行下列语句后输出的结果为 int a 0 while a 10 a System out println a 执行下列语句输出的结果为 int a 6 if a 5 if a 5 System out println a5 下列哪个选项是java语言所不具备的 以下哪个是Runnable接口中定义的方法 抽象方法定义和常量值的集合是 下列不属于条件控制语句的是 下列说法正确的是 选项 42 420 462 42042D 2 3 1 2 2 3D 00 001 000120C 00012021 编译错误 5 6 5 5B 6 5 6 6 23 234 235 2345 2357 23457 编译错误 1 2 12 编译错误 没有输出E 运行时发生异常 2 1 2 4 2 5C 3 1 3 4 3 5 编译错误 运行时发生异常 2 3 4 6 7E 编译错误 hi hi hi world world world 编译错误D 运行时发生异常 编译错误 atom granite grantie granite atom granite granite 运行时发生异常 atom granite atom graniteF 13 134 1234C 2134 2143 4321 运行时发生异常 第七行错误 第四行错误C 编译正确 运行正常 foofoofoofoofoo foobarfoobarbar foobarfoofoofoo foobarfoobarfooD barbarbarbarbar foofoofoobarbar foofoofoobarfoo 3 23 32 123D 321 true true false trueB true false false false 编译错误 运行时发生异常 A Line 26 prints a to System out A B Line 26 prints b to System out 运行时发生异常 第6行编译错误 any class only the Target class any class in the test packageC any class that extends Target 0 0 0 150 60 0 编译错误 150 150 150D 运行时发生异常 如果删除第十行 编译可以通过 如果第11行删除 编译可以通过 如果第12行删除 编译可以通过C 如果第13行删除 编译可以通过 以上答案都不正确 Canada null Canada Canada null Canada Canada 第26行编译错误E 第29行编译错误 Alpha a x Foo f Delta x B Foo f Alpha x Beta b Beta Alpha x b 3A b 8 b 13 f 3 f 8 f 13 TestA TestBB 编译错误 运行时发生异常 Direction d NORTH Nav Direction d NORTH Direction d Direction NORTH Nav Direction d Nav Direction NORTH D p setWeight 420 A p changePayload 420 p new Payload 420 Payload setWeight 420 p Payload setWeight 420 r t t r e o 编译错误C 运行时发生异常 Compilation fails An exception is thrown at runtime doStuff x 6 main x 6D doStuff x 6 main x 7 doStuff x 7 main x 6 doStuff x 7 main x 7 1 0 true FALSED A类被称之为父类 B类被称之为子类 A类的特性多余B类C B类的特性多余A类 FALSEA true 0 1 if 3 5 System out println hello if false System out println hello if 5 3 System out println hello if 0 System out println hello D public static void main public static void main char c public void main public static void main String args D double floate longA double long float long double float long float double 0 1 10C 9 a5 a5两条输出 什么也不会输出D 封装 继承 跨平台 无需编译D static run B stop yield 单元 接口B 成员 变量 for语句A if语句 if else语句 if语句的扩展形式 不需定义类 就能创建对象 属性可以是简单变量 也可以是一个对象B 属性必须是简单变量 对象中必有属性和方法 题目 以下代码 10 interface Jumper public void jump 20 class Animal 30 class Dog extends Animal 31 Tail tail 32 40 class Beagle extends Dog implements Jumper 41 public void jump 42 50 class Cat implements Jumper 51 public void jump 52 以下语句哪三条是正确的 以下代码 10 class One 11 void foo 12 13 class Two extends One 14 insert method here 15 在14行处单独插入以下哪些个方法才能让两个Class编译通过 以下代码 1 class Mammal 2 3 class Raccoon extends Mammal 4 Mammal m new Mammal 5 6 7 class BabyRaccoon extends Mammal 哪四条语句是正确的 以下代码 1 class One 2 public One foo return this 3 4 class Two extends One 5 public One foo return this 6 7 class Three extends Two 8 insert method here 9 单独插入哪些方法可以成功编译三个class 以下代码 1 class Employee 2 String name double baseSalary 3 public Employee String name double baseSalary 4 this name name 5 this baseSalary baseSalary 6 7 8 public class SalesPerson extends Employee 9 double commission 10 public SalesPerson String name 11 double baseSalary double commission 12 insert code here 13 14 在12行处单独插入哪些代码 可以让程序编译通过 以下代码 1 public abstract class Shape 2 private int x 3 private int y 4 public abstract void draw 5 public void setAnchor int x int y 6 this x x 7 this y y 8 9 正确使用Shape类的是 以下代码 11 public interface Status 12 insert code here int MY VALUE 10 13 以下哪些代码插入在12行处是合法的 以下代码 10 abstract class A 11 abstract void a1 12 void a2 13 14 class B extends A 15 void a1 16 void a2 17 18 class C extends B void c1 和 A x new B C y new C A z new C 哪些是合法的多态方法调用 以下哪些代码片段是合法的读取Console 一行文本的方法 下列说法错误的有 选项 Cat is a Animal Cat is a Jumper1 Dog is a Animal1 Dog is a Jumper Cat has a Animal Beagle has a Tail1 Beagle has a Jumper int foo more code here void foo more code here 1正确 public void foo more code here 1正确 private void foo more code here protected void foo more code here 1正确 Raccoon is a Mammal 1正确 Raccoon has a Mammal 1正确 BabyRaccoon is a Mammal 1正确 BabyRaccoon is a Raccoon public void foo public int foo return 3 public Two foo return this 1正确 public One foo return this 1正确 public Object foo return this super name baseSalary 1正确 mission commission 1 super mission commission 1 mission commission super 1 su
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 祭奠仪式追思词范本
- 宗教行业线上活动组织与信徒管理方案
- 《感恩于心回报于行》主题班会教案
- 供货协议书(模板)
- 列车控制技术试题及答案
- 2024年镇妇联三八节活动方案
- 2025年挖掘机租赁协议参考样本
- 个人汽车租用合同范本
- 《我的经济权利》教案设计
- 高中物理电场线的教案设计
- 高中生物开学第一课课件 高一生物(人教版)必修1
- 送配电线路工(送电)-初级工模拟题含答案(附解析)
- 供应商物流管理办法规定
- 2025新食品安全法及修订解读企业应对新规培训课件
- 儿童糖尿病酮症酸中毒诊疗指南解读 2
- JJG 264-2025谷物容重器检定规程
- 中国足协D级教练员理论培训大纲
- 实验室人员培训
- 人工流产护理查房
- 部编五年级上册语文教案全册表格版
- 2025血管内导管相关性血流感染预防与诊治指南
评论
0/150
提交评论