wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Help needed 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 "Help needed" Watch "Help needed" New topic
Author

Help needed

arivu mathi
Ranch Hand

Joined: Jun 26, 2006
Posts: 38
public class Test extends A{
Test(){
System.out.println("Sub");
}
public static void main(String args[]) {
Test t = new Test();
}
}
class A{
A(int i){
System.out.println("Super");
}
}


plz explain the output
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Please use tags.
Please use a meaningful topic title.
What output does it give? Explain what you do not understand about it.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
sachinb mahajan
Greenhorn

Joined: Jun 30, 2006
Posts: 6
It wont give any output. Code wont get compiled. The Base class A has a constructor which takes int as an argument. Any class extending it has to have a constructor which will explicitly call base class constructor



else compiler will put default no arg super call in the derived class constructor which will cause the compilation to fail.
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
Constructor
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help needed