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 JQ+: Constructors and access 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 "JQ+: Constructors and access" Watch "JQ+: Constructors and access" New topic
Author

JQ+: Constructors and access

Ranjan Chaudhuri
Ranch Hand

Joined: May 22, 2001
Posts: 33
True or False:
You can only call public and protected constructors of the superclass in a subclass if the subclass is not in the same package because only those are inherited.
If the answer is "False," please provide an example to illustrate.
Thanks.
kanchan chaudhary
Greenhorn

Joined: Jun 06, 2001
Posts: 28
Hi,
I think, U can access the public & protected constructors in other package also. But the reason is not correct as the constructors R not inherited, they R accessible.
Thanks
kanchan
Bin Wang
Ranch Hand

Joined: May 01, 2001
Posts: 82
Originally posted by Ranjan Chaudhuri:
True or False:
You can only call public and protected constructors of the superclass in a subclass if the subclass is not in the same package because only those are inherited.
If the answer is "False," please provide an example to illustrate.
Thanks.

Ranjan,
You must forget that constructors are not inherited, right?
Opps,
Ranjan Chaudhuri
Ranch Hand

Joined: May 22, 2001
Posts: 33
Thanks Kanchan and Bin.
I need to learn to read the COMPLETE #$%^& question!
Anyway, to confirm what you say with a quote from the JLS(8.2)
"Constructors, static initializers, and instance initializers are not members and therefore not inherited."
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JQ+: Constructors and access