This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Polymorphism: SCJP 1.5 Part2 - Question: 18.  RSS feed

 
Alam Ameghino
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends.

This is a question about polymorphism.

The exercise is the next:

The options are:

1.) #1
2.) #2
3.) #3
4.) #4
5.) Nowhere, since this program does not compile
6.) This program is not valid and hence there is no poymorphism

The correct answers are 2) y 3), but for me it is wrong. For me there isn't polymorphism in previous example.


Polymorphism is present in the next exercise. Here, in runtime, JVM decide what m() method is called.

Am I right?

Thanks!
 
Alam Ameghino
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, and the explication is: "Polymorphism is exhibited wherever a base class calls a subclass implementation".
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!