网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
public class CreditCard { private String cardlD; private Integer limit; public String ownerName; public void setCardlnformation(String cardlD, String ownerName, 28. Integer limit) { this.cardlD = cardlD; this.ownerName = ownerName; this.limit = limit; } } Which is true?()
- A、 The class is fully encapsulated.
- B、 The code demonstrates polymorphism.
- C、 The ownerName variable breaks encapsulation.
- D、 The cardlD and limit variables break polymorphism.
- E、 The setCardlnformation method breaks encapsulation.
参考答案
更多 “ public class CreditCard { private String cardlD; private Integer limit; public String ownerName; public void setCardlnformation(String cardlD, String ownerName, 28. Integer limit) { this.cardlD = cardlD; this.ownerName = ownerName; this.limit = limit; } } Which is true?() A、 The class is fully encapsulated.B、 The code demonstrates polymorphism.C、 The ownerName variable breaks encapsulation.D、 The cardlD and limit variables break polymorphism.E、 The setCardlnformation method breaks encapsulation.” 相关考题
考题
public class ArrayTest { public static void main (Stringargs) { float f1, f2; f1 = new float [10]; f2 = f1; System.out.printIn (“f2[0]=” + f2[0]); } } What is the result?()A、 It prints f2[0] = 0.0B、 It prints f2[0] = NaNC、 An error at line 5 causes compile to fail.D、 An error at line 6 causes compile to fail.E、 An error at line 6 causes an exception at runtime.
考题
int i = 0, j = 5; tp; for (;;) { i++; for(;;) { if (i --j) { break tp; break tp; } } System.out.println(“i=” +i “,j =”+j); } What is the result?() A、 i = 1, j = 0B、 i = 1, j = 4C、 i = 3, j = 4D、 i = 3, j = 0E、 Compilation fails.
考题
public class Pet{ private String name; public Pet(String name){ this.name = name; } public void speak(){ System.out.print(name); } } public class Dog extends Pet{ public Dog(String name){ super(name); } public void speak(){ super.speak(); System.out.print(“ Dog ”); } } 执行代码 Pet pet = new Dog(“京巴”); pet.speak(); 后输出的内容是哪项?() A、 京巴B、 京巴 DogC、 nullD、 Dog京巴
考题
You want a class to have access to members of another class in the same package. Which is the most restrictive access modifier that will accomplish that will accomplish this objective?() A、 PublicB、 PrivateC、 ProtectedD、 TransientE、 No access modifier is required.
考题
现有: interface Data {public void load();} abstract class Info {public abstract void load();} 下列类定义中正确使用Data和Info的是哪项?() A、 public class Employee implements Info extends Data { public void load(){/*dosomething*/} }B、public class Employee extends Inf.implements Data{ public void load() {/*do something*/} }C、public class Empl.yee implements Inf extends Data{ public void Data.1oad(){* do something*/} public void load(){/*do something*/} }D、public class Employee extends Inf implements Data { public void Data.1oad() {/*do something*/) public void info.1oad(){/*do something*/} }
考题
abstract class A { abstract void al(); void a2() { } } class B extends A { void a1() { } void a2() { } } class C extends B { void c1() { } } and: A x = new B(); C y = new C(); A z = new C(); Which four are valid examples of polymorphic method calls?()A、 x.a2();B、 z.a2();C、 z.c1();D、 z.a1();E、 y.c1();F、 x.a1();
考题
现有: class ThreadExcept implements Runnable { public void run() { throw new RuntimeException("exception "); } public static void main(String [] args) { new Thread(new ThreadExcept()).start(); try { int x = Integer.parseInt(args[0]); Thread.sleep(x); System.out.print("main "); } catch (Exception e) { } } } 和命令行: java ThreadExcept 1000 哪一个是结果?() A、 mainB、 编译失败C、 代码运行,但没有输出D、 main java.lang.RuntimeException: exception
考题
Which will declare a method that forces a subclass to implement it?() A、 Public double methoda();B、 Static void methoda (double d1) {}C、 Public native double methoda();D、 Abstract public void methoda();E、 Protected void methoda (double d1){}
热门标签
最新试卷