多项选择题

Assume that country is set for each class. 
Given: 
10. public class Money { 
11. private String country, name; 
12. public getCountry() { return country; } 
13.} 
and: 
24. class Yen extends Money { 
25. public String getCountry() { return super.country; } 
26. } 
27. 
28. class Euro extends Money { 
29. public String getCountry(String timeZone) { 
30. return super.getCountry(); 
31. } 
32. } 
Which two are correct?()

A. Yen returns correct values.
B. Euro returns correct values.
C. An exception is thrown at runtime.
D. Yen and Euro both return correct values.
E. Compilation fails because of an error at line 25.
F. Compilation fails because of an error at line 30.


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题

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.

3.多项选择题

31. // some code here 
32. try { 
33. // some code here 
34. } catch (SomeException se) { 
35. // some code here 
36. } finally { 
37. // some code here 
38. } 
Under which three circumstances will the code on line 37 be executed?()

A. The instance gets garbage collected.
B. The code on line 33 throws an exception.
C. The code on line 35 throws an exception.
D. The code on line 31 throws an exception.
E. The code on line 33 executes successfully.

5.多项选择题

10. public class Bar { 
11.static void foo(int...x) { 
12. // insert code here 
13. } 
14. } 
Which two code fragments, inserted independently at line 12, will allow the class to compile?()

A. foreach(x) System.out.println(z);
B. for(int z : x) System.out.println(z);
C. while( x.hasNext()) System.out.println( x.next());
D. for( int i=0; i< x.length; i++ ) System.out.println(x[i]);

8.单项选择题A Button is positioned in a Frame. Only height of the Button is affected by the Frame while the width is not. Which layout manager should be used?()    

A. FlowLayout
B. CardLayout
C. North and South of BorderLayout
D. East and West of BorderLayout
E. GridLayout

10.多项选择题

public class Parent {    
int change() {…}    
} 
class Child extends Parent { 
   } 
Which methods can be added into class Child?()    

A. public int change(){}
B. int chang(int i){}
C. private int change(){}
D. abstract int chang(){}