Write a Java program to demonstrate an abstract class having variables and methods
abstract class Shape { String color; Shape(String color) { this.color = color; } abstract void draw(); void displayColor() { System.out.println("Shape color is : " + color); } } class Circle extends Shape { Circle(String color) { super(color); } @Override void draw() { System.out.println("Drawing Circle"); } } public class Main { public static void main(String[] args) { Circle circle = new Circle("Blue"); circle.displayColor(); circle.draw(); } }
Shape color is : Blue Drawing Circle
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions