Suppose A is an interface, B is a concrete class with a default constructor that implements A. Which of the following is correct?

Suppose A is an interface, B is a concrete class with a default 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();

The correct answer is BD

Explanation: Since B is a concrete class with a default constructor, d is correct. Since an instance of B is also an instance of A, b is also correct.


Java

Learn More Multiple Choice Question :