| 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: 14672
|
|
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: 14672
|
|
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
|
 |
 |
|
|
subject: Explain the output
|
|
|