Friday, 9 October 2015

Java Static polymorphism example


public class First {

public static void main(String[] args) {
// TODO Auto-generated method stub
Second obj = new Third();
obj.show();
}

}



public class Second {

static void show(){
System.out.println("Parent");
}
}


class Third extends Second{
static void show(){
System.out.println("Child");
}
}

output:-
Parent

No comments:

Post a Comment