Home > Java Programming > Inner Classes > Questions and Answers
Q: |
What will be the output of the program? public class HorseTest { public static void main (String [] args) { class Horse { public String name; /* Line 7 */ public Horse(String s) { name = s; } } /* class Horse ends */ Object obj = new Horse("Zippo"); /* Line 13 */ Horse h = (Horse) obj; /* Line 14 */ System.out.println(h.name); } } /* class HorseTest ends */ | ||||||||||
|
Comment on this Question | |
Name: | |
|