You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* A java program to create a abstract class shape that contain an empty method named as number of sides and 3 classes triangle, rectangle and hexagon.Such that each class extends
shape. Each class contains the method number of sides to show the number of sides*/
abstract class Shape{
abstract void numberofsides();
}
class Triangle extends Shape{
void numberofsides(){
System.out.println("The Number of Sides of triangle is 3 ");
}
}
class Rectangle extends Shape{
void numberofsides(){
System.out.println("The Number of Sides of rectangle is 4 ");
}
}
class Hexagon extends Shape{
void numberofsides(){
System.out.println("The Number of Sides of hexagon is 6 ");