提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
向TreeMap添加和获取值
import java.util.TreeMap; public class Main {/**from N o w J a v a . c o m - 时 代 Java**/ public static void main(String[] args) { TreeMap treeMap = new TreeMap(); treeMap.put("One", new Integer(1)); treeMap.put("Two", new Integer(2)); Object obj = treeMap.get("Two"); System.out.println(obj); } }