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( );
f.display( );
r.display( );
b.display( );
}
public static void main(String[ ] args)
{
new Inherit( );
}
}
Correct Answer:
Verified
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q19: Java allows one to create polymorphic references
Q30: Is it possible to use both overloading
Q61: A JSlider, xSlider, is used to change
Q62: Why is it almost always a good
Q63: Consider this statement: If you declare a
Q64: The GUI should react whenever the JButton
Q66: Write the code needed to set up
Q67: Why would you not need to implement
Q68: What is early binding?
What is late
Q69: Explain why an abstract method cannot be
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