標籤: 定義:指允許不同類的對象對同一訊息做出響應。即同一訊息可以根據發送對象的不同而採用多種不同的行為方式。(發送訊息就是函數調用) 多態的前提: A:有繼承或者實現關係。 B:有方法重寫。 C:有父類或者父介面引用指向子類對象。 多態的分類: a:具體類多態 class Fu {} class Zi extends Fu {} Fu f = new
標籤:特點: 將桶分段,並在某個段上加鎖,提高並發能力 源碼分析: V put(K key, int hash, V value, boolean onlyIfAbsent) { lock(); try { int c = count; if (c++ > threshold) // ensure capacity rehash();
標籤:Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the largest product =
標籤:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.You may assume no duplicate exists in the array.解題思路:本題和Java for LeetCode 033 Search in Rotated
標籤:在JAVA中形式參數主要有基本類型,類名,抽象類別名,介面名。下面我們來各自講述。1.基本類型 這個太簡單不做簡述。2.類名 類名:需要該類的對象 1 class Student { 2 public void study() { 3 System.out.println("Good Good Study,Day Day Up"); 4 } 5 } 6 7 class StudentDemo { 8 public void
標籤:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.The array may contain duplicates.解題思路:參考Java for LeetCode 081 Search in Rotated Sorted Array II
標籤:java socket報文通訊(一) socket的建立今天來和大家分享一下java中如何使用socket進行通訊。先來囉嗦兩句,看看Tcp/ip和udp:TCP是 Transfer Control Protocol 的 簡稱,是一種連線導向的保證可靠傳輸的協議。通過TCP協議傳輸,得到的是一個順序的無差錯的資料流。發送方和接收方的成對的兩個socket之間必須建 立串連,以便在TCP協議的基礎上進行通訊,當一個socket(通常都是server