GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes Explain the output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Explain the output" Watch "Explain the output" New topic
Author

Explain the output

Shafian Kisna
Ranch Hand

Joined: Oct 25, 2005
Posts: 70
package spital;

public class Mudchute extends Spital{
public static void main(String argv[]){

Mudchute ms = new Mudchute();
ms.go();
}
public Mudchute(){
super(10);
}
public void go(){
island();

}
public void island(){
System.out.println("island");
}

}

I was looking through some of the practice guide and came across this code. Can someone kindly explain to me the answer. The answer given is output is prints out 10 island. Please explain.

Appreciate the assistance.

Best Rgds
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

It's difficult to say without Spital.java


[My Blog]
All roads lead to JavaRanch
Shafian Kisna
Ranch Hand

Joined: Oct 25, 2005
Posts: 70
Hi,

Neither do I have access to the class. So could I conclude what the Spital.java could be?
if the super(10) is given in this method, what could possibly the Spital.java hold?

Pls guide.

Thanks
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

It could have a default constructor, and a constructor with (possibly) an "int" parameter, containing a print call.


[ March 02, 2006: Message edited by: Satou kurinosuke ]
Shafian Kisna
Ranch Hand

Joined: Oct 25, 2005
Posts: 70
Hi,

Thanks a lot, wanted some confirmation...

It did help.

Best Regards
 
GeeCON Prague 2014
 
subject: Explain the output