Regarding overriding Principles
<p>I was developing a program keeping the concept of overriding in my mind..</p>

<pre><code>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
{
    public void method1 ()  {
        System.out.println ("Child's method1 ()");
    }
       //overriding
    public void method2 ()  {
        System.out.println ("Child's method2 ()");
    }

    public static void main (String args []) {
        Parent p = new Child ();
        p.method2 ();//parent
    }
}
</code></pre>

<p>Now when I call the method2() , parent class method2() is called  , as seen above I am passing the parent reference while creating the object but in similar fashion if I want to access child class method2(), then one approach is to directly make the object of child class but If I want to call child class method2() in similar fashion by passing the parent reference then how it would be possible please advise. </p>
