Assuming that the class ThisClass that implements an interfa

Assuming that the class (ThisClass) that implements an interface (ThisInterface), and both are written correctly.

ThisClass has a default constructor that takes no arguments

which of the following will compile?

a) ThisClass x = new ThisInterface();

b) ThisClass x;

c) ThisInterface x = new ThisInterface();

d) ThisInterface x;

e) ThisInterface x = new ThisClass();

Solution

Given the class ThisClass that implements an interface ThisInterface.

ThisClass has a default constructor that takes no arguments

Following will compile---------->

Interfacename object = new classname()

So answer will------>

e) ThisInterface x = new ThisClass();

and

b) ThisClass x;

Assuming that the class (ThisClass) that implements an interface (ThisInterface), and both are written correctly. ThisClass has a default constructor that takes

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site