hi ,
As far as i know , protected memebers can only be accessed from inside the class or by a class which is inheriting it , but here i am able to call a protected member from outside a class & the irony is the second class is not inheriting it .
Please explain me where am i wrong ?
Here is the code
class visible
{
protected void dis()
{
System.out.println("In dis visible");
}
}
______________________________________________________________________
Now
class
test {
public static void main(
String arg[])
{
visible b = new visible();
b.dis();
}
}
o/p is
In dis visible (WHY )