posted 23 years ago
The foll question is from Bill Brogden's Exam Cram chp 5,p.94 Q(4)
class NormalClass{
static class NestedClass{
}
which of the following is correct way to declare and initialize a ref to a Nested class object
(a)
NormalClass.NestedClass mync = new
NormalClass.NestedClass();// ans.
(b)
NestedClass myNC = new NormalClass().new NestedClass()// ok incorrect
(c)
NestedClass myNC = new NormalClass.NestedClass();/* why this is incorrect??? Is this not a correct way to reference a static class ?
for a top level nested(static)class, you dont need a ref to enclosed class, so even this should work
NestedClass nc1 = new NestedClass();
any explanation would be appreciated.*/
}
}
------------------
[This message has been edited by Shiva (edited April 12, 2000).]