in java, 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() {...


in java,


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();


}


}



Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here