Sm0ke
19-07-2017 17:05 Polymorthysm in Java
I knew it earlier but didn't think about:
"There are two types of polymorphism in java: compile time polymorphism and runtime polymorphism. We can perform polymorphism in java by method overloading and method overriding."
First type of polymothism is overloading. Java compiler determines which overloaded method is invoked by the reference type (not the object type)
Second is overriding. JVM at runtime "see" on instance (real object) and run its methods. Determination by object type.

Animal animal = new Horse();
Reference type Object type

That's why we talk about compile time and runtime polymorthism.

Current music: Om Asa Toma (Original Mix) - The Wise Man
Состояние: учиться
Группы: [ english ] [ java ]

Ваш комментарий:
Гость []
[смайлики сайта]
Автоматическое распознавание URL
Не преобразовывать смайлики
Cкрыть комментарий
Закрыть