sgsfg

来源:互联网 发布:软件定制化开发 编辑:程序博客网 时间:2024/06/05 18:49
package adqwer;import java.util.IdentityHashMap;import java.util.Map;import java.util.Map.Entry;public class test1 {      public static void main(String[] args) {                    String str1 = new String("xx");          String str2 = new String("xx");          System.out.println(str1 == str2);                    Map<String ,String> map = new IdentityHashMap<String ,String>();          map.put(str1, "hello");          map.put(str2, "world");                          for(Entry<String,String> entry : map.entrySet())          {              System.out.println(entry.getKey()+"   " + entry.getValue());          }          System.out.println("     containsKey---> " + map.containsKey("xx"));          System.out.println("str1 containsKey---> " + map.containsKey(str1));          System.out.println("str2 containsKey---> " + map.containsKey(str2));          System.out.println("      value----> " + map.get("xx"));          System.out.println("str1  value----> " + map.get(str1));          System.out.println("str2  value----> " + map.get(str2));      }  }    

原创粉丝点击