Category: ocpjp 1.6

runtime polymorphism in java

Hello all, in previous article we learned about compile time polymorphism and how it is used in method overloading. In this article we will see about runtime polymorphism. Runtime polymorphism is achieved using method overriding. Rules for method overriding are…

final variables in java

Hello all, We all know that the value of final variables cannot be changed in java. Consider following code

We are changing the value of someNumber here so obviously compilation is not successful as it is  final  variable and cannot be changed.…

Generics: The wildcard operator

In the previous part of this tutorial, Polymorphism with generics we have learned the shortcomings of generics while using polymorphism with it.In this part, we are going to overcome them using wildcard operator. Please read this article before continuing. Vehicle…

Generics: Polymorphism with generics

In An Introduction To Generics we learned about declaring and using generics. In this part of the tutorial we are going to learn polymorphism with generics. Consider this declarations.

List is the base type. String is the generic type ArrayList