This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Associate Certification (OCAJP 7) and the fly likes Access modifier for no-args constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Associate Certification (OCAJP 7)
Bookmark "Access modifier for no-args constructor" Watch "Access modifier for no-args constructor" New topic
Author

Access modifier for no-args constructor

Glenn Gould
Greenhorn

Joined: Jul 09, 2013
Posts: 5

The default no-arg constructor is created by the compiler implicitly.

Can someone verify the following:

The access type of a default constructor is the same as the access type of the declared class.

So if the class in question is



the default no-args constructor which is implicitly created
will have access modifier "default" (also known as package access).

Please confirm.
Thanks in advance.
E Armitage
Rancher

Joined: Mar 17, 2012
Posts: 888
    
    9
Yes, http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8.9
 
Don't get me started about those stupid light bulbs.
 
subject: Access modifier for no-args constructor
 
Similar Threads
Constructor question
Acceess Modifiers
Implicitly given access modifier
Default constructor
are constructors inherited?