File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Help needed

arivu mathi
Ranch Hand

Joined: Jun 26, 2006
Posts: 38
public class Test extends A{
public static void main(String args[]) {
Test t = new Test();
class A{
A(int i){

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

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
I agree. Here's the link:
subject: Help needed
It's not a secret anymore!