File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes SubClass Constructor Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "SubClass Constructor Question" Watch "SubClass Constructor Question" New topic

SubClass Constructor Question

Ehsan Rahman
Ranch Hand

Joined: Feb 16, 2009
Posts: 59

Hello everyone,


and ...

Why is it that the "new FundamentalsTest();" statement in line 9 is not valid but the constructor chaining call by SubFundamentals to the FundamentalsTest() constructor is valid?

Many Thanks,

SCJP 1.5, SCJD 1.6
Tom Johnson
Ranch Hand

Joined: May 11, 2005
Posts: 142
The class named FundamentalsTest is not in the same package as SubFundamentals. The constructor of FundamentalsTest is protected, hence you cannot call it directly from a different package.

<a href="" target="_blank" rel="nofollow">Use Code Tags!!</a>
I agree. Here's the link:
subject: SubClass Constructor Question
It's not a secret anymore!