Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Explain the output

 
Shafian Kisna
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's difficult to say without Spital.java
 
Shafian Kisna
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks a lot, wanted some confirmation...

It did help.

Best Regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic