Which code can be used to create and initialize an object of class ColorPencil?
class Shape {} class ColorShape extends Shape { String color; ColorShape(String color) {this.color = color;} }
C, D
A is incorrect because new ColorShape() tries to invoke the noargument constructor of class ColorShape, which isn't defined in class ColorShape.
B is incorrect because new ColorShape(RED) tries to pass a variable RED, which isn't defined in the code.