File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes default constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "default constructor" Watch "default constructor" New topic
Author

default constructor

Yi Meng
Ranch Hand

Joined: May 07, 2003
Posts: 270
i saw somewhere stating that the default contructor always has public or defult access visibility.
But to me, i suppose those default constructor within private inner class would have private visibility and so for protected. is it true?


Meng Yi
Lawrence Chettiar
Ranch Hand

Joined: Apr 10, 2003
Posts: 62
Yep as per JLS
If the class is declared public, then the default constructor is implicitly given the access modifier public (�6.6); if the class is declared protected, then the default constructor is implicitly given the access modifier protected (�6.6); if the class is declared private, then the default constructor is implicitly given the access modifier private (�6.6); otherwise, the default constructor has the default access implied by no access modifier
Hope this helps
Lawrence


SCJP 1.4 (86%)<br />SCMAD Beta (77%)<br />SCEA (part I:89%,partII:93%)<br />MCAD (cleared 70-315 & 70-320 [Score 980])
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: default constructor