• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Explain the output

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks a lot, wanted some confirmation...

It did help.

Best Regards
 
reply
    Bookmark Topic Watch Topic
  • New Topic