Write a java program : Create an interface named ‘Figure’ with an abstract void method ‘shape()’. Now create two classes ‘Rectangle’ and ‘Triangle’ implementing the ‘Figure’ interface and having the...


Write a java program :


Create an interface named ‘Figure’ with an abstract void method ‘shape()’. Now create two classes
‘Rectangle’ and ‘Triangle’ implementing the ‘Figure’ interface and having the method ‘shape()’
which will print “This is rectangular shape” and “This is triangular shape” respectively. Also create a
subclass ‘Square’ of ‘Rectangle’ having the method ‘shape()’ to print “Square is a rectangle with
equal sides”. Now call the method of ‘Rectangle’ and ‘Square’ class by the object of ‘Square’ class.
Expected Output:
This is rectangular shape
Square is a rectangle with equal sides



Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here