class Bank {
int rateOfInterest() {
return 0;
}
}
class PNB extends Bank {
int rateOfInterest() {
return 6;
}
}
class BOB extends Bank {
int rateOfInterest() {
return 7;
}
}
class HDFC extends Bank {
int rateOfInterest() {
return 8;
}
}
public class TestMethodOverRiding {
public static void main(String args[]) {
PNB p = new PNB();
BOB b = new BOB();
HDFC h = new HDFC();
System.out.println("Rate of interest of PNB is = " + p.rateOfInterest() + "%");
System.out.println("Rate of interest of BOB is = " + b.rateOfInterest() + "%");
System.out.println("Rate of interest of HDFC is = " + h.rateOfInterest() + "%");
}
}