Hello All...
This is from JLS 8.8.8 Preventing Instantiation of a Class
"If the class is declared public, then the default constructor is
implicitly given the access modifier public"
But in the same page, (the Example appearing at the end of the page)
Example:-
package just;
public class PackageOnly
{
PackageOnly() { }
String[] justDesserts = { "cheesecake", "ice cream" };
}
" The class PackageOnly can be instantiated only within the package
just, in which it is declared."
Can someone explain me why the class PackageOnly can be instantiated
only within the package just-- whereas it is mentioned that the
constructor will have access modifier depending upon the Access Modifier
of the class.
Thanks.