Card 19 / 32: 1. public class HorseTest { 2. public static void main(String[] args) { 3. class Horse { 4. public String name; 5. public Horse(String s) { 6. name = s; 7. } 8. } 9. Object obj = new Horse("Zippo"); 10. Horse h = (Horse) obj; 11. System.out.println(h.name); 12. } 13. } What is the result?
A)
compilation fails
B)
Zippo
C)
runtime exception thrown
D)
None of the above
Answer:
B) Zippo
Previous Card | ← Previous Card Button |
Next Card | → Next Card Button |
Flip Card | Space-Bar |
|