Hi,
I want to know what will be the out put and why it is so?
public class Merry {
static void doHelloGoodbye(Base b){
b.greeting();
b.farewell();
}
public static void main(
String args[]){
Sub s = new Sub();
doHelloGoodbye(s);
}
}
class Base{
static void greeting(){
System.out.println("Hello");
}
void farewell(){
System.out.println("Goodbye");
}
}
class Sub extends Base{
static void greeting(){
System.out.println("Hi");
}
void farewell(){
System.out.println("See ya!");
}
}
Thanks in advance.