| Author |
SubClass Constructor Question
|
Ehsan Rahman
Ranch Hand
Joined: Feb 16, 2009
Posts: 59
|
|
Hello everyone,
Suppose:
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,
Ehsan
|
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="http://faq.javaranch.com/java/UseCodeTags" target="_blank" rel="nofollow">Use Code Tags!!</a>
|
 |
 |
|
|
subject: SubClass Constructor Question
|
|
|