Given the following declarations: abstract class A { int x; A() { x = 10; } void
ID: 3924742 • Letter: G
Question
Given the following declarations:
abstract class A
{
int x;
A()
{
x = 10;
}
void print(double a)
{
System.out.println("Hi a is " + a);
}
void print(){}
}
class B extends A
{
void print()
{
System.out.println("Does this even works?");
super.print(25.5);
}
}
Select responses that would best describe these classes.
SELECT ALL POSSIBLE RESPONSES
Select one or more:
a. class B is an abstract class
b. class B is a concrete class
c. class B must be declared with the keyword abstract, or class B must define both methods it inherited for it not to be an abstract class
d. The statement A a = new A() will not compile.
e. Both classes compile fine
f. The keyword super should be first executable statement in the method
Explanation / Answer
Here is the answer for your question.
All the statements which are true are selected according to these statements which you have given
Select one or more:
b. class B is a concrete class
d. The statement A a = new A() will not compile.
f. The keyword super should be first executable statement in the method
Explanation:
A class which contains the keyword abstact before the class is called abstract class
A class which implements all the missing functionality of abstract classis called concrete class.
The keyword super should be first executable statement in the method of derived class.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.