| Author |
constructor
|
dolly shah
Ranch Hand
Joined: Jun 18, 2007
Posts: 383
|
|
public class A { A(){} } A The class A can be referenced outside the package in which it is defined. B The class A cannot be instantiated outside the package in which it is defined. C The class A cannot be extended outside the package in which it is defined. Why B & C are correct? It is a public class. Because of non-public constructor. Correct me if I am wrong.
|
SCJP-1.5<br />SCWCD-1.4
|
 |
christian combarel
Ranch Hand
Joined: Aug 04, 2007
Posts: 47
|
|
Yes you're right. If the constructor has a default acces level, you can neither instanciate the class nor extends it outside the package.
|
-------------
Chris
|
 |
dolly shah
Ranch Hand
Joined: Jun 18, 2007
Posts: 383
|
|
|
Thanks
|
 |
 |
|
|
subject: constructor
|
|
|