Covariant Return Type
One of the pillars of Object Oriented Java language is Polymorphism. Polymorphism allows two or more methods within the same class that share the same name, as long as their parameter declarations are different . It also allows two or more methods in class hierarchy where child class can have same method name as of parent class, but their signature should be same. Here is a limitation on overridden methods, they can not have different return types. J2SE 5.0 has come up with a solution for this limitation. Onwards J2SE 5.0 new feature called “Covariant Return Types”. “As per Covariant Return Types, a method in a subclass may return an object whose type is a subclass of the type returned by the method with the same signature in the superclass.” Consider following example 1: class ParentClass 2: { 3: public SuperValue getValue(){ 4: System.out.println(" ParentClass.getValue() "); 5: return new SuperValue(); 6: } 7: 8: } 9: 10: 11: public c...