Interface Example,Real life ,class implementation Like hierarchical inheritance

Java Programming Language Abstarct class and Methods in java (Article) Abstarct class and Methods in java (Program)

1696

Program:

interface Bank{
float rateOfInterest();
}

class CANARA implements Bank{
 public float rateOfInterest(){
	return 4.15f;
	}
}

class BORADA implements Bank{
 public float rateOfInterest(){
	return 7.7f;
	}
}

class InterfaceClass{
	public static void main(String[] args){
	Bank b=new BORADA();
	System.out.println("Rate Of Interest: "+b.rateOfInterest());
	}
}

  

Output:

Rate Of Interest: 7.7
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.