Consider the code shown below. It contains a syntax error, preventing successful compilation and execution. What is the error?
public class Inherit
{
class Figure
{
void display()
{
System.out.println("Figure");
}
}
class Rectangle extends Figure
{
final void display()
{
System.out.println("Rectangle");
}
}
class Box extends Rectangle
{
void display() {
System.out.println("Box");
}
}
Inherit()
{
Figure f = new Figure();
Rectangle r = new Rectangle();
Box b = new Box();
b.display();
}
public static void main(String[] args)
{
new Inherit();
}
}
f.display();
r.display();
Correct Answer:
Verified
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q30: Is it possible to use both overloading
Q31: Although insertion sort and selection sort have
Q32: Code Example Ch 10-1
An int array
Q33: Write an insertion sort method to sort
Q34: If you instantiate an abstract class, the
Q35: Code Example Ch 10-1
An int array
Q37: We compare sorting algorithms by examining
A) the
Q38: Consider this statement: If you declare a
Q39: Both the insertion sort and the selection
Q40: Which of the following is true about
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents