This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Can anyone give about the access modifier for the default compiler generated constructors. If the class is a outer class what is the access modifier applied? If the class is a inner class what is the access modifier applied? If the class is top level nested class then what is the access modifier?
If a class contains no constructor declarations, then a default constructor that takes no parameters is automatically provided:
* If the class being declared is the primordial class Object, then the default constructor has an empty body. * Otherwise, the default constructor takes no parameters and simply invokes the superclass constructor with no arguments.
A compile-time error occurs if a default constructor is provided by the compiler but the superclass does not have an accessible constructor that takes no arguments.
A default constructor has no throws clause.
It follows that if the nullary constructor of the superclass has a throws clause, then a compile-time error will occur. In an enum type (�8.9), the default constructor is implicitly private. Otherwise, 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.