单项选择题

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 this code from Class B:  
25. A a1 = new A();  
26. A a2 = new A();  
27. A a3 = new A();  
28. System.out.println(A.getInstanceCount()); 
 What is the result?()

A. Compilation of class A fails.
B. Line 28 prints the value 3 to System.out.
C. Line 28 prints the value 1 to System.out.
D. Compilation fails because of an error on line 28.
E. A runtime error occurs when line 25 executes.

3.多项选择题

Given:  
10. class One {  
11. void foo() { }  
12. }  
13. class Two extends One {  
14. //insert method here  
15. }  
Which three methods, inserted individually at line 14, will correctly complete class Two?()

A. public void foo() { /* more code here */ }
B. private void foo() { /* more code here */ }
C. protected void foo() { /* more code here */ }
D. int foo() { /* more code here */ }  
E. void foo() { /* more code here */ }

最新试题

Given the command line java Pass2 and:What is the result? ()

题型:单项选择题

Given:  11. public void genNumbers() {  12. ArrayList numbers = new ArrayList();  13. for (int i=0; i<10; i++) {14. int value = i * ((int) Math.random());  15. Integer intObj = new Integer(value);  16. numbers.add(intObj);  17. }  18. System.out.println(numbers);  19. }  Which line of code marks the earliest point that an object referenced by intObj becomes a  candidate for garbage collection?()

题型:单项选择题

Given: What is the result?()

题型:单项选择题

Given:Which five methods, inserted independently at line 5, will compile?()

题型:多项选择题

Which two code fragments correctly create and initialize a static array of int elements?()

题型:多项选择题

Given:Which statement is true?()

题型:单项选择题

Given:  11. static class A {  12. void process() throws Exception { throw new Exception(); }  13. }  14. static class B extends A {  15. void process() { System.out.println("B "); }  16. }  17. public static void main(String[] args) {  18. A a = new B();  19. a.process();  20. }  What is the result? ()

题型:单项选择题

Given:  12. System.out.format("Pi is approximately %d.", Math.PI);  What is the result?()

题型:单项选择题

Click the Exhibit button.  Given this code from Class B:  25. A a1 = new A();  26. A a2 = new A();  27. A a3 = new A();  28. System.out.println(A.getInstanceCount());  What is the result?()

题型:单项选择题

Given:  11. String test = "This is a test";  12. String[] tokens = test.split("\s");  13. System.out.println(tokens.length);  What is the result?()

题型:单项选择题