package methodOverridding;
public class MethodOverridingExample3 extends MethodOverRiddingExampe1{
/*public void test1(){
System.out.println("I am from child class");
}*/
public static void main(String[] args) {
MethodOverRiddingExampe1 obj = new MethodOverridingExample3();
obj.test1();
/**
* At run time method will be called based on the class for which we have
* created object.
*/
}
}
public class MethodOverridingExample3 extends MethodOverRiddingExampe1{
/*public void test1(){
System.out.println("I am from child class");
}*/
public static void main(String[] args) {
MethodOverRiddingExampe1 obj = new MethodOverridingExample3();
obj.test1();
/**
* At run time method will be called based on the class for which we have
* created object.
*/
}
}
No comments:
Post a Comment