Hi All, I have tried to answer the following Q's... please correct me if I am wrong.
1. Which of the following is true. a. An interface can contain a top level nested inner class. b. An interface can contain a member inner class. - T c. A member inner class can implement an interface. - T d. A static method can contain a local class. e. A static method can contain a nested top level local class.
2. FilterInputStream chaining is defined as - a. Ability to sequentially open a collection of streams. b. Ability to redirect the output of one stream to the input of another - T c. Ability to open a high level inputstream on a lower level input stream. d. Ability to the constructor of one stream to call that of another. In the above Q, all the options seems right..... but I think b is only true... Kindly help. Thx in advance. Aruna
Sagar Sharma
Ranch Hand
Joined: Aug 31, 2000
Posts: 92
posted
0
HI, for q.1 a is also right try the following code: interface a{ public static class abc{} } the above code does not report an error. So (a) is right For q-2 (d) is right as constructors do call other constructors while chaining. Since it is not always chaining a hihg level stream to a low level stream (c) is false. BufferedInputStream can be chained with DataInputStream and both are high level streams. (a) is false because only opening the streams does not gaurantee chaining. they have to be chained by constructor calls. hope i am right and it helps u.
Sagar
Aru Ven
Ranch Hand
Joined: Sep 28, 2000
Posts: 199
posted
0
Thx for ur Help Sagar, Aruna
mohit joshi
Ranch Hand
Joined: Sep 23, 2000
Posts: 243
posted
0
The following code shows that static methods can have local inner classes defined within them. So option d is also correct.
//interface can contain a member inner class //inner member class can implement an interface interface II { public class CC { class DD implements II { } int i; static void amethod(){ class EE {int e; } } } } In my openion when we are chaining one input stream to another input stream one can always be considered a lower level.(The high and low levels are relative and not absolute) Option B sounds more like describing Piped Input - Output, I dont know if that is correct. Any suggestions welcome.