aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes constructor problem? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "constructor problem?" Watch "constructor problem?" New topic
Author

constructor problem?

Vishy Karl
Ranch Hand

Joined: Sep 08, 2003
Posts: 116
Hi All ,
Why does the foll. code compile??

I was expecting a compile time error as teh Class B does not contain the no-arg. constructor . Then how is the call to super(); in Class C resolved ???
Thanks in advance,
Best wishes,


"The man who can drive himself further once the effort gets painful is the man who will win." <br />Roger Bannister
Lakshmi Saradha
Ranch Hand

Joined: Oct 21, 2003
Posts: 170
Hi Vishy,
This is a tricky question.The line
public boolean B(String msg)
is a method and not a constructor since there is a boolean return type.
Sice there is no constructor,, a default nor arg constructor is provided adn hence this code gives no compiler error.


Thanks,<br />Lakshmi.
Krishna Srinivasan
Ranch Hand

Joined: Jul 28, 2003
Posts: 1844

class B doesn't define any constructors, it will call default no-argument constructor....


Krishna Srinivasan
Spring Tutorials, OCAJP Mock Questions, 400+ OCPJP Mock Questions
Vishy Karl
Ranch Hand

Joined: Sep 08, 2003
Posts: 116
OOps , Sorry for the silly mistake
Thanks for your replies
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: constructor problem?
 
Similar Threads
A Question about Constructors
mock test question need help
Exam question - constructors- help!
Constructor in parent class
constructor