Hi,

With the following code I am able to access the private variable of another class.How does this explain data hiding concept.

public class Y extends X
{
public static void main(String[] arg)
{ int val;
X x = new X();
val = x.m1(2);
System.out.println(val);

}

}

class X {
private int y ;
public int m1(int a){
y =a ;
System.out.println("ans=" + y);
return y;
}

}

Thanks,
Deepa