package day06;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
public class MapDemo1 {
public static void main(String[] args) {
Map <String,Integer>map = new LinkedHashMap<String,Integer>();
map.put("语文",99 );
map.put("数学",98 );
map.put("英语",97 );
map.put("物理",96 );
map.put("化学",99 );
System.out.println(map);
Integer num = map.put("语文", 70);
System.out.println(map);
System.out.println(num);
num = map.get("数学");
System.out.println("数学:"+num);
System.out.println("体育:"+map.get("体育"));
System.out.println("将语文删除");
num = map.remove("语文");
System.out.println(map);
System.out.println(num);
map.remove("语文");
}
}
|