Posts

Showing posts with the label Abstract class

abstract class in java with example

An abstract class is a class, that is declared as abstract. Abstract class contains 0 or more abstract methods. Abstract classes can not be instantiated but that can be sub classed.           An abstract method is a methods that is declared without any implementation. Like this, 1 2 3 abstract class Car { abstract void show (); }           •    A class with abstract methods is called abstract class. The both abstract method and abstract class must be declared with abstract.           •   In case where you want to use implementation inheritance then it is usually provided by an abstract base class. Abstract classes are excellent candidates inside of application frameworks.           •    Abstract classes let you define some default behavior and force sub-classes to provide any specific behavior.                     Here is the abstract class example with abstract methods as well as concrete methods. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1