Hi Chandra,
First i have to say, your explanation confused me a lot. becuase i don't know he concept before. Last night i saw sun book. then i got "what you want to say !"
I thank you for showing the notation: class MyClas<T extends Comparable<? super T>>. Though your explanation confusing
you did a great job, Keep it up.
Here is the clear cut code: which is self explanatory
class MyList<T extends Comparable<? super T>>{
}
class Employee implements Comparable<Employee>{
public int compareTo(Employee o){
return 0; // just added to suffice int return
}
}
class Manager extends Employee{
}
public class SuperTest{
public static void main(
String... a) {
MyList<Employee> empList = new MyList<Employee>();
MyList<Manager> mgrList = new MyList<Manager>();
/* MyList<Manager> is legal here because of notation "<? super T>"
Checks like ...
1)if T declared implements Comparable<T> or the super class did it or not.
2)if substitute Manager for T then ---> <? super Manager>.
3)Means does Manager or the super class implemented it ? here in our case super class Employee did it. Hence it is valid.
*/
}
}
Thanks again Chandra,
[ March 01, 2007: Message edited by: Srinivasan thoyyeti ]