I am not clear !!! Why is (1) wrong? Since the class is public we can a refernce of this class outside. For eg:
package OtherPackage;
public class A
{
A(){}
}
public class B extends A
{
public B(){}
public A returnReference()
{
return new A();
}
}
Now consider this:
package P;
class
Test {
OtherPackage.A a = new B().returnReference();
}
So, out here u are able to reference class A outside the package. So, how can we say that the class A can be referenced outside the package in which it is defined?
Shouldn't (1) be true as well??
Please correct me if I am wrong!!
- sampaths77