Suppose A is an interface, B is a concrete class with a no-arg constructor that implements A. 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...

Pressing the Tab key in the last cell in a spreadsheet creates a blank row

Indicate whether the statement is true or false

Computer Science & Information Technology

Which of the following is an Excel add-in used to find solutions to complex problems?

A) What-if analysis B) Goal Seek C) Scenario Manager D) Solver

Computer Science & Information Technology