Write a Java program to demonstrate the concept of an abstract class and an abstract method
abstract class Shape { abstract void draw(); } class Circle extends Shape { @Override void draw() { System.out.println("Drawing Circle"); } } class Rectangle extends Shape { @Override void draw() { System.out.println("Drawing Rectangle"); } } public class Main { public static void main(String[] args) { Shape circle = new Circle(); Shape rectangle = new Rectangle(); circle.draw(); rectangle.draw(); } }
Drawing Circle Drawing Rectangle
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions