Posts

Showing posts with the label Abstract class

Abstract class in java

A class that is declared with abstract keyword, is known as abstract class in java. It can have abstract and non-abstract methods.  If a class has at least one abstract method then the class must be declared as abstract .  abstract class can't be initiated . To use an abstract class , you have to extends it to another class and must be implement all the abstract method .  Example :   abstract class Bank{            abstract int getBalance();        }   class Savings extends Bank{            int getBalance(){return 40;}       }   class Current extends Bank{          int getBalance(){return 200;}    }        class Test{         public static void main(String args[]){...