g4share / javaLearning

0 stars 0 forks source link

OOP Principles - Polymorphism #4

Open g4share opened 8 months ago

g4share commented 8 months ago

Write a Java program to create a class Shape with methods getArea() and getPerimeter(). Create three subclasses: Circle, Rectangle, and Triangle. Override the getArea() and getPerimeter() methods in each subclass to calculate and return the area and perimeter of the respective shapes.