The cardID and limit variables break polymorphism.
The code demonstrates polymorphism.
The ownerName variable breaks encapsulation.
The setCardInformation method breaks encapsulation.
The class is fully encapsulated.
第1题:
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.
第2题:
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.
第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.
第4题:
Which of the following statements about variables and scope are true?()
第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?()
第6题:
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 }
第7题:
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.
第8题:
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.
第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();
第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?()