Java program for Single Inheritance
KW.java
class Bank
{
    void Bonus()
    {
       System.out.print("Festival Bonus: ");
    }  
}
class WhiteBank extends Bank
{
    void WhiteBankBonus()
    {
        System.out.println("WhiteBank 1500");
    }
}

class KW 
{
    public static void main(String[] args) 
    {
        WhiteBank wb=new WhiteBank();
        wb.Bonus();
        wb.WhiteBankBonus();
    }
}
Output
kodingwindow@kw:~$ javac KW.java
kodingwindow@kw:~$ java KW Festival Bonus: WhiteBank 1500 kodingwindow@kw:~$
Advertisement