oromia construction corporation vacancy 2022
A class containing one or more abstract methods is called an abstract class. An abstract class must be declared with a class-modifier abstract. An abstract class CANNOT be instantiated, as its definition is not complete. UML Notation: abstract class and method are shown in italic. Abstract Class EG. 1: Shape and its Subclasses. abstract class Shape { int color; // An abstract function abstract void draw (); } In java, following are some important observations about abstract classes are as follows: An instance of an abstract class can not be created. Constructors are allowed. We can have an abstract class without any abstract method. object is created - its class is called an immutable class Example immutable class: no set method in the Circle class public class Circle{private double radius; public Circle() { } public Circle(double radius) { this.radius = radius; } public double getRadius() { return radius; }} radius is private and cannot be changed without a set method.