與Java 一樣,Kotlin 也提供泛型,為型別安全提供保證,消除型別強轉的煩惱。 宣告一個泛型類: class Box<T>(t: T) { var value = https://www.itread01.com/kotlin/t }.
確定! 回上一頁