Choose the best option based on this program:.
class Shape { public Shape() { System.out.println("Shape constructor"); }//ww w . j a va 2 s .co m public class Color { public Color() { System.out.println("Color constructor"); } } } public class Main { public static void main(String []args) { Shape.Color black = new Shape().Color(); // #1 } }
Color()
is undefined for the type shapeA.
You need to create an instance of outer class shape in order to create an inner class instance, as in new Shape()
.new Color()
;.