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