Consider the following Java code class B extends A B abs

Consider the following Java code.

class B extends A
{

B() { }

}

abstract class A
{

A() { }

}

SELECT ALL POSSIBLE RESPONSES

Select one or more:

a. B b = new B();

b. B b = new (B);

c. A a = new B();

d. A a = new A();

e. B b = new A();

f. The codes will not compile, because the abstract class \"A\" should come before the concrete class \"B\"

Solution

Answer:

Below two are all possible responses

a. B b = new B();

c. A a = new B();

Issue wth below statement is Incorrect instantiation (syntax issue)

b. B b = new (B);

Issue with below statement is we can not create an instance of child class that is referenced from parent class.

e. B b = new A();

Issue with below statement is we an not create an instance for abstract classes. Here A is an abstract class.

d. A a = new A();

F option is having incorrect statement. There is no order required to create a classes.

Consider the following Java code. class B extends A { B() { } } abstract class A { A() { } } SELECT ALL POSSIBLE RESPONSES Select one or more: a. B b = new B();

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site