**E(泛型)** ```java 1.如果不傳類型,則E就相當(dāng)于Object。 2.<E extends A>相當(dāng)于定義了E的上限,即E必須為A的子類。 3.<E super A>相當(dāng)于定義了E的下線,即A必須為E的子類。(示例:Comparator) ```
http://m.o2fo.com/toniko/toniko-i5wa32yi.html...e** **從小到大排序(即:this,o)所需Comparable示例:** ```java class A implements Comparable<A>{ public int n; @Override public int compareTo(A o) { // TODO Auto-generated method stub if (this.n > o.n) { return 1; } else if(this.n == o.n) { return 0; } else { return -1; } }...
http://m.o2fo.com/toniko/toniko-evgt32yl.html**集合特點(diǎn):** ```java 1.HashSet:存儲(chǔ)數(shù)據(jù),不能重復(fù)。 2.TreeSet:存儲(chǔ)數(shù)據(jù),不能重復(fù),自動(dòng)對(duì)數(shù)據(jù)排序。 3.ArrayList:存儲(chǔ)數(shù)據(jù),可以重復(fù),有下標(biāo),查找效率高。 4.LinkedList:存儲(chǔ)數(shù)據(jù),可以重復(fù),有下標(biāo),增加、刪除效率高。 ``...
http://m.o2fo.com/toniko/toniko-3z6l32yn.html...能有一個(gè),實(shí)參在傳入時(shí)可以不傳,也可以傳多個(gè)。 ```java public void print(int i, int j, String... m) { System.out.print(i + " " + j + " "); for(String str : m) { System.out.print(str + " "); } System.out.println(); } //調(diào)用: new A().print(1, 2); new A().print(1, 2, "a", "ab...
http://m.o2fo.com/toniko/toniko-b49u32z8.html**default** default在接口方法中使用,方法為默認(rèn)方法,實(shí)現(xiàn)此接口的類可以不實(shí)現(xiàn)此方法。 ```java interface I1{ default void helloWorld() { System.out.println("HelloWorld"); } } class A implements I1{ } //調(diào)用: A a = new A(); a.helloWorld(); ```
http://m.o2fo.com/toniko/toniko-wy6g32z9.html**main** 主方法: ```java public class Test { public static void main(String[] args) { //我的代碼 } } ```
http://m.o2fo.com/toniko/toniko-nrv8330b.html**Entry** 可以用于遍歷Map,以HashMap為例: ```java HashMap<String, Integer> hashMap = new HashMap<>(); hashMap.put("a", 1); hashMap.put("b", 2); hashMap.put("c", 3); Set<Entry<String, Integer>> eSet = hashMap.entrySet(); for(Entry<String, Integer> entry : eSe...
http://m.o2fo.com/toniko/toniko-5pkv330i.html```java public class MyThread extends Thread { @Override public void run() { // TODO Auto-generated method stub for(int i = 0; i < 30; i++) { System.out.println(Thread.currentThread().getName()+":i="+i); } } public static void main(String[] args) { new MyThread().start(); new MyThread().start(); ...
http://m.o2fo.com/toniko/toniko-c6mt3382.html```java 1.join():Thread對(duì)象中調(diào)用。 如果在a線程中調(diào)用b(Thread)對(duì)象的join方法,那么a線程被阻塞,等待b線程運(yùn)行完畢再運(yùn)行a線程。 2.yield():Thread的靜態(tài)方法。 哪個(gè)線程調(diào)用此方法,哪個(gè)線程就會(huì)讓出cpu的資源,但有可能又得...
http://m.o2fo.com/toniko/toniko-2o7k3387.html...,兩者都拿著各自的鎖不松手。造成死鎖,無輸出。 ```java public class MyThread{ public static void main(String[] args) throws InterruptedException { Object goods = new Object(); Object money = new Object(); Test1 t1 = new Test1(goods, money); Test2 t2 = new Test2(goods, money); ...
http://m.o2fo.com/toniko/toniko-63ao338j.html抱歉,暫時(shí)沒有相關(guān)的微課
w3cschool 建議您:
抱歉,暫時(shí)沒有相關(guān)的視頻課程
w3cschool 建議您:
抱歉,暫時(shí)沒有相關(guān)的教程
w3cschool 建議您:
**E(泛型)** ```java 1.如果不傳類型,則E就相當(dāng)于Object。 2.<E extends A>相當(dāng)于定義了E的上限,即E必須為A的子類。 3.<E super A>相當(dāng)于定義了E的下線,即A必須為E的子類。(示例:Comparator) ```
http://m.o2fo.com/toniko/toniko-i5wa32yi.html...e** **從小到大排序(即:this,o)所需Comparable示例:** ```java class A implements Comparable<A>{ public int n; @Override public int compareTo(A o) { // TODO Auto-generated method stub if (this.n > o.n) { return 1; } else if(this.n == o.n) { return 0; } else { return -1; } }...
http://m.o2fo.com/toniko/toniko-evgt32yl.html**集合特點(diǎn):** ```java 1.HashSet:存儲(chǔ)數(shù)據(jù),不能重復(fù)。 2.TreeSet:存儲(chǔ)數(shù)據(jù),不能重復(fù),自動(dòng)對(duì)數(shù)據(jù)排序。 3.ArrayList:存儲(chǔ)數(shù)據(jù),可以重復(fù),有下標(biāo),查找效率高。 4.LinkedList:存儲(chǔ)數(shù)據(jù),可以重復(fù),有下標(biāo),增加、刪除效率高。 ``...
http://m.o2fo.com/toniko/toniko-3z6l32yn.html...能有一個(gè),實(shí)參在傳入時(shí)可以不傳,也可以傳多個(gè)。 ```java public void print(int i, int j, String... m) { System.out.print(i + " " + j + " "); for(String str : m) { System.out.print(str + " "); } System.out.println(); } //調(diào)用: new A().print(1, 2); new A().print(1, 2, "a", "ab...
http://m.o2fo.com/toniko/toniko-b49u32z8.html**default** default在接口方法中使用,方法為默認(rèn)方法,實(shí)現(xiàn)此接口的類可以不實(shí)現(xiàn)此方法。 ```java interface I1{ default void helloWorld() { System.out.println("HelloWorld"); } } class A implements I1{ } //調(diào)用: A a = new A(); a.helloWorld(); ```
http://m.o2fo.com/toniko/toniko-wy6g32z9.html**main** 主方法: ```java public class Test { public static void main(String[] args) { //我的代碼 } } ```
http://m.o2fo.com/toniko/toniko-nrv8330b.html**Entry** 可以用于遍歷Map,以HashMap為例: ```java HashMap<String, Integer> hashMap = new HashMap<>(); hashMap.put("a", 1); hashMap.put("b", 2); hashMap.put("c", 3); Set<Entry<String, Integer>> eSet = hashMap.entrySet(); for(Entry<String, Integer> entry : eSe...
http://m.o2fo.com/toniko/toniko-5pkv330i.html```java public class MyThread extends Thread { @Override public void run() { // TODO Auto-generated method stub for(int i = 0; i < 30; i++) { System.out.println(Thread.currentThread().getName()+":i="+i); } } public static void main(String[] args) { new MyThread().start(); new MyThread().start(); ...
http://m.o2fo.com/toniko/toniko-c6mt3382.html```java 1.join():Thread對(duì)象中調(diào)用。 如果在a線程中調(diào)用b(Thread)對(duì)象的join方法,那么a線程被阻塞,等待b線程運(yùn)行完畢再運(yùn)行a線程。 2.yield():Thread的靜態(tài)方法。 哪個(gè)線程調(diào)用此方法,哪個(gè)線程就會(huì)讓出cpu的資源,但有可能又得...
http://m.o2fo.com/toniko/toniko-2o7k3387.html...,兩者都拿著各自的鎖不松手。造成死鎖,無輸出。 ```java public class MyThread{ public static void main(String[] args) throws InterruptedException { Object goods = new Object(); Object money = new Object(); Test1 t1 = new Test1(goods, money); Test2 t2 = new Test2(goods, money); ...
http://m.o2fo.com/toniko/toniko-63ao338j.html抱歉,暫時(shí)沒有相關(guān)的文章
w3cschool 建議您: