Data members are resolving on reffrence basis

can u guide me in clear way how it works?

class Parent
{
int data =100;
}

class Child extends Parent
{
int data = 50;
public static void main(String[] args)
{
Child c=new Child();
System.out.println(“Reference of Child Type :”
+ c.data);

    Parent p=new Child();
  
    // Par holding child object will access the data
    // variable of parent class 
    System.out.println("Reference of Parent Type : "
                       + p.data); 
} 

}
o/p:-Reference of Child Type : 50
Reference of Parent Type : 100

If a parent reference variable is holding the reference of the child class and we have the same data member in both the parent and child class, then it will refer to the parent class data member , whether it is holding child class object reference.