Which of the following code fragments shows the correct way to declare and initialize a reference to a NestedClass object from outside BaseClass? : Questions « Object Oriented « SCJP
class BaseClass {
BaseClass() {
}
publicclass NestedClass {
NestedClass() {
}
}
}
A. BaseClass.NestedClass myNC = new BaseClass.NestedClass();
B. NestedClass myNC = new BaseClass().new NestedClass();
C. NestedClass myNC = new BaseClass.NestedClass();
D. BaseClass.NestedClass nbc = new BaseClass().new NestedClass();