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 asubclass ‘Square’ of ‘Rectangle’ having the method ‘shape()’ to print “Square is a rectangle withequal sides”. Now call the method of ‘Rectangle’ and ‘Square’ class by the object of ‘Square’ class.Expected Output:This is rectangular shapeSquare is a rectangle with equal sides
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here