看板 java 關於我們 聯絡資訊
※ 引述《shedoh (仙道)》之銘言: : 我自己是亂試過把 C 改成 => interface C<T> extends Comparable<T>{} 先看 sort() 的 definition: public static void sort(<T extends Comparable<? super T>>) 這是什麼意思? 也就是你丟進去的型 T,它本身必須 extends (impelments) Comparable<? super T> ? super T 又是什麼?就是那個 Comparable 的 generic type 必須是 T 的 super class T 是 C 的 super class 嗎? 不是。 就這樣了。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 147.8.127.102 ※ 編輯: superlubu 來自: 147.8.127.102 (11/12 12:23)
shedoh:抱歉不是很懂所以再請教一下,所以不能對interface sort囉? 11/12 12:34
shedoh:即便所有implement該interface的class都會實作comparable? 11/12 12:36
shedoh:還是有其他寫法可以達成類似我要的效果嗎? 11/12 12:38
No:意思是C的Comparable的GenericType必須是C本身 11/12 15:12
No:interface C<T> extends Comparable<C<T>> 11/12 15:13
shedoh:了解了...感謝 11/12 17:27