Java Reference
In-Depth Information
which of the following statements are true? (Select two.)
A. Lines 10 and 11 generate a compiler error.
B. Lines 8 to 13 are an anonymous inner class declaration.
C. The object instantiated on line 8 does not have access to the frame field on line 5
because frame is private.
D. The method on line 9 never executes because its definition goes out of scope after line 15.
E. The anonymous inner class on line 8 is a child of WindowAdapter.
19. Suppose a method in a class has the following method declaration:
public java.io.OutputStream createStream(String fileName) {
//method body here...
}
Which of the following methods could appear in a child class and override
createStream ? (Select two.)
A. public java.io.OutputStream createStream(String f)
B. public java.io.OutputStream createStream(char c)
C. public java.io.FileOutputStream createStream(String f)
D. public void createStream(String c)
E. public java.io.OutputStream createStream(StringBuffer fileName)
F. protected java.io.OutputStream createStream(String fileName)
20. Given the following class definitions, what is the output of the statement new Child();?
1. class Parent {
2. {
3. System.out.print(“1”);
4. }
5.
6. public Parent(String greeting) {
7. System.out.print(“2”);
8. }
9. }
10.
11. class Child extends Parent {
12. static {
13. System.out.print(“3”);
14. }
15.
16. {
17. System.out.print(“4”);
18. }
19. }
Search WWH ::




Custom Search