单选题Given: Which statement is true?()A  The cardID and limit variables break polymorphism.B  The code demonstrates polymorphism.C  The ownerName variable breaks encapsulation.D  The setCardInformation method breaks encapsulation.E  The class is fully 

题目
单选题
Given: Which statement is true?()
A

 The cardID and limit variables break polymorphism.

B

 The code demonstrates polymorphism.

C

 The ownerName variable breaks encapsulation.

D

 The setCardInformation method breaks encapsulation.

E

 The class is fully encapsulated.

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Click the Exhibit button. Given:Which statement is true if a TestException is thrown on line 3 of class B? ()

A.Line 33 must be called within a try block.

B.The exception thrown by method1 in class A is not required to be caught.

C.The method declared on line 31 must be declared to throw a RuntimeException.

D.On line 5 of class A, the call to method2 of class B does not need to be placed in a try/catch block.


参考答案:B

第2题:

Click the Exhibit button. Given:Which two statements are true if a NullPointerException is thrown on line 3 of class C? ()

A.The application will crash.

B.The code on line 29 will be executed.

C.The code on line 5 of class A will execute.

D.The code on line 5 of class B will execute.

E.The exception will be propagated back to line 27.


参考答案:B, E

第3题:

You are creating a class that performs complex financial calculations.The class contains a method named GetCurrentRate that retrieves the current interest rate and a variable named currRate that stores the current interest rate.You write serialized representations of the class.You need to write a code segment that updates the currRate variable with the current interest ratewhen an instance of the class is deserialized.Which code segment should you use?()

A.

B.

C.

D.


参考答案:D

第4题:

Which of the following statements about variables and scope are true?() 

  • A、 Local variables defined inside a method are destroyed when the method is exited.
  • B、 Local variables are also called automatic variables.
  • C、 Variables defined outside a method are created when the object is constructed.
  • D、 A method parameter variable continues to exist for as long as the object is needed in which the method is defined.

正确答案:A,B,C

第5题:

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.

正确答案:C

第6题:

Given:Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ?()

A.move the line 12 print statement into the foo() method

B.change line 7 to public synchronized void go() {

C.change the variable declaration on line 2 to private volatile int x;

D.wrap the code inside the foo() method with a synchronized( this ) block

E.wrap the for loop code inside the go() method with a synchronized block synchronized(this){ //for loop code here }


参考答案:A, D

第7题:

Given:Which statement is true about the class of an object that can reference the variable base? ()

A.It can be any class.

B.No class has access to base.

C.The class must belong to the geometry package.

D.The class must be a subclass of the class Hypotenuse.


参考答案:C

第8题:

Given:Which statement is true?()

A. Compilation succeeds.

B. Class A does not compile.

C. The method declared on line 9 cannot be modified to throw TestException.

D. TestA compiles if line 10 is enclosed in a try/catch block that catches TestException.


参考答案:D

第9题:

Given that Thing is a class, how many objects and reference variables are created by the following code?()   Thing item, stuff;   item = new Thing();   Thing entity = new Thing();

  • A、One object is created
  • B、Two objects are created
  • C、Three objects are created
  • D、One reference variable is created
  • E、Two reference variables are created
  • F、Three reference variables are created.

正确答案:B,F

第10题:

Given this method in a class:  public String toString() {  StringBuffer buffer = new StringBuffer();  buffer.append(‟<‟);  buffer.append(this.name);  buffer.append(‟>‟);  return buffer.toString();  }  Which is true?() 

  • A、 This code is NOT thread-safe.
  • B、 The programmer can replace StringBuffer with StringBuilder with no other changes.
  • C、 This code will perform well and converting the code to use StringBuilder will not enhance the performance.
  • D、 This code will perform poorly. For better performance, the code should be rewritten: return “<“+ this.name + “>”;

正确答案:B

更多相关问题