freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

java編程基礎(chǔ)課程-300集史上最全、最深、最細(xì)(編輯修改稿)

2024-11-23 01:18 本頁(yè)面
 

【文章內(nèi)容簡(jiǎn)介】 E 等泛型字母為 有類型, 類型參數(shù)賦予具體的值 – ? 未知類型 類型參數(shù)賦予丌確定值 , 任意類型 ? 只能用在聲明類型 、方法參數(shù)上, 丌能用在定義泛型類上 ? 通配符 (代碼片段 ) //此處 T不能夠換成 ? public class StudentT { T score。 public static void main(String[] args) { //通配符 :用在聲明類型 Student? stu = new StudentString()。 test(new StudentInteger())。 } //通配符 :用在聲明方法參數(shù) 接收信息 public static void test(Student? stu){ //獲取信息 ()。 } } 上限 ? 上限 extends :指定的類型必須是繼承某個(gè)類,或者實(shí)現(xiàn)某個(gè)接口 (丌是用implements),即 =如 – ? extends Fruit – T extends List ? 丌能添加信息 ? 存在以下規(guī)則 ,如 – ListFruit 滿足 List? extends Fruit – List? extends Apple 滿足 List? extends Fruit – List?等同 List? extends Object public void test(List? extends Fruit list){ (new Fruit(“f))。 (new Pear(“p))。 (new Apple(“a))。 } 以上代碼無(wú)法通過(guò)編譯。為什么呢?? public class FooT extends List { public static void main(String[] args) { //上限 FooArrayList f =new FooArrayList。 FooLinkedList f2 =new FooLinkedList。 } } 下限 ? 下限 super:指定的類型丌能小于操作的類 ,即 = – T super Apple – ? super Apple ? 丌能添加父對(duì)象 ? 存在以下規(guī)則 ,如 – List? super Fruit 滿足 List? super Apple – ListFruit 滿足 List? super Fruit public void test(List? super Apple list){ (new Apple(“apple))。 (new FujiApple(“fuji))。 (new Fruit(“fruit”))。 } 以上代碼哪一行不能通過(guò)編譯。為什么呢?? 泛型嵌套 ? 稍微復(fù)雜一些,從外到內(nèi)拆分 public class StudentT { T score。 } public static void main(String[] args) { //泛型的嵌套 BjsxtStudentString room =new BjsxtStudentString()。 //從外到內(nèi)拆分 = new StudentString()。 StudentString stu = 。 String score =。 (score)。 } public class Bjsxt T{ T stu 。 } 其他 ? 泛型沒(méi)有多態(tài) ? 沒(méi)有泛型數(shù)組 ? jdk7簡(jiǎn)化泛型 public class Jdk7{ public static void main(String[] args) { // ListString arrList= new ArrayListString()。 //,聲明類型即可,使用 |創(chuàng)建時(shí)不用指定類型 ListString arrList2= new ArrayList()。 } } public class OthersApp { public static void
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1