Header Ads Widget

operator overloading in java

  Code:-

interface Bank
{
float rate_of_interest();
}
class SBI implements Bank
{
public float rate_of_interest()
{
return 9.15f;
}
}
class UBI implements Bank
{
public float rate_of_interest()
{
return 9.7f;
}
}
class Main
{
public static void main(String [] args)
{
Bank b=new SBI();
System.out.println("Rate of interest of SBI is "+b.rate_of_interest());
Bank UB=new UBI();
System.out.println("Rate of interest of SBI is "+UB.rate_of_interest());
}
}

Output:-

Rate of interest of SBI is 9.15
Rate of interest of SBI is 9.7

Recommended Post:

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-

Post a Comment

0 Comments