int size java_int size()
int size()
描述 (Description)
size()方法用于獲取此哈希表中的鍵數。
聲明 (Declaration)
以下是java.util.Hashtable.size()方法的聲明。public int size()
參數 (Parameters)
NA
返回值 (Return Value)
方法調用返回此哈希表中的鍵數。
異常 (Exception)
NA
例子 (Example)
以下示例顯示了java.util.Hashtable.size()的用法package com.iowiki;
import java.util.*;
public class HashTableDemo {
public static void main(String args[]) {
// create hash table
Hashtable htable = new Hashtable(3);
// populate the table
htable.put(1, "TP");
htable.put(2, "IS");
htable.put(3, "THE");
htable.put(4, "BEST");
htable.put(5, "TUTORIAL");
System.out.println("Size of the hash table is: "+htable.size());
}
}
讓我們編譯并運行上面的程序,這將產生以下結果。Size of the hash table is: 5
總結
以上是生活随笔為你收集整理的int size java_int size()的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 预测模型(数学建模)
- 下一篇: 41、OrthoMCL和mcl软件进行基