• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

default constructor

 
Yi Meng
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Lawrence Chettiar
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic