Hi all,
Check out the following example . Plz. give a explanation for the output as when i ran the code i was surprised by the result
thanks in advance.
---------------------------------------
class Parent
{
private void method1()
{
System.out.println("Parent's method1()");
}
public void method2()
{
System.out.println("Parent's method2()");
method1();
}
}
class Child extends Parent
{
private void method1()
{
System.out.println("Child's method1()");
}
public static void main(
String args[])
{
Child c = new Child();
c.method2();
}
}