Java program to create an abstract class


Posted Date:     Total Responses: 0    Posted By: Sunil Reddy   Member Level: Gold   Points/Cash: 2   


import java.lang.*;
abstract class Shape
{
abstract void numberOfSides();
}
class Traingle extends Shape
{
public void numberOfSides()
{
System.out.println("three");
}
}
class Trapezoid extends Shape
{
public void numberOfSides()
{
System.out.println("four");
}
}
class Hexagon extends Shape
{
public void numberOfSides()
{
System.out.println("six");
}
}
public class Sides
{
public static void main(String arg[])
{
Traingle T=new Traingle();
Trapezoid Ta=new Trapezoid();
Hexagon H=new Hexagon();
T.numberOfSides();
Ta.numberOfSides();
H.numberOfSides();


Project Feedbacks


No feedbacks found. Be the first to respond...

Post Feedback
You must Sign In to post a feedback.
Next Project: Java program that allows the user to draw lines,rectangles and ovals
Previous Project: C program, using pointer for string comparison

Return to Project Index

Post New Project


Related Projects


Complete the action items below to enter to win an iPad Mini from India Study Channel! in India Study Channel - Locker on LockerDome
Awards & Gifts
Active Members
TodayLast 7 Daysmore...

 
ISC Technologies, Kochi - India. © All Rights Reserved.