As we know we can not add any value except null to collection if we use ? extends syntax. What if we want to add value to the collection, then we have to use ? super syntax. the code looks like this. 1 List<? super Dog> list1 = new ArrayList<dog>(); before discussing why it is [...]
Archive | September, 2008
Generic Methods in Java 5.0
September 17, 2008
In java 1.5 we have a feature called generic methods, with this we can write a method, which can be generic, means it can be called by any parameter and behavior of the method will be according to the parameter passed. Assume that we need to write a method which takes an array and converts [...]
Handle exceptions in overriding methods
September 17, 2008
The question why makes any topic makes more clearer and interesting than just to know about what the concept is. The rule about exceptions when we use them in overriding is: If super class method is throwing any exception(checked) and if we are overriding that method in sub class Then the subclass method can be [...]






September 18, 2008
0 Comments