Suppose A is an abstract class, B is a concrete subclass of A, and both A and B have a no-arg constructor. Which of the following is correct?

a. A a = new A();
b. A a = new B();
c. B b = new A();
d. B b = new B();

b. A a = new B();
d. B b = new B();
Since B is a concrete class with a no-arg constructor, d is correct. Since an instance of B is also an instance of A, b is also correct.

Computer Science & Information Technology

You might also like to view...

Watermarks should be placed on slides with a limited amount of text and not make the slide difficult to read

Indicate whether the statement is true or false

Computer Science & Information Technology

Only the Pro or Enterprise editions of Windows 8.1 can be a Remote Desktop host (Server)

Indicate whether the statement is true or false

Computer Science & Information Technology