点击运行
import java.util.HashMap; public class Main { public static void main(String[] args) { HashMap
sites = new HashMap<>(); sites.put(1, "Google"); sites.put(2, "Jiyik"); sites.put(3, "Taobao"); System.out.println("HashMap: " + sites); // 从HashMap中删除所有映射 // 重新初始化 hashmap sites = new HashMap<>(); System.out.println("新的 HashMap: " + sites); } }
运行结果 :
正在执行...