import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Hashtable;
import java.util.TreeMap;
/*
 Set keys1 = map.keySet();
  Set keys2 = map.keySet();
  Set keys3 = map.keySet();
上面三个set对象key1,key2,key3引用的是一个对象。
这是map的keySet()方法只返回一个set实例,所以当从key1中删除一个对象时候,
key2和key3将会受到影响。 */
class  HashMaps
{
       public static void main(String[]args)
      {
            Map map=new HashMap(); 
            
            map.put("a", "aaa");
            map.put("b", "bbb");
            map.put("c", "ccc");
            map.put("d", "ddd");
            map.put("e","eee");
         //System.out.println(map.size());//public int size()返回此映射中的键-值映射关系数。          
         System.out.println( map.get("e"));//get()方法的参数是key 类型,是根据key值来决定结果输出eee
         Set key1 = map.keySet();
          Set key2 = map.keySet();
           Set key3 = map.keySet();
           
         System.out.println(key1);
         System.out.println(key2);
         System.out.println(key3);
         /*
          这段代码输出
          [d, a, c, b, e]
          [d, a, c, b, e]
          [d, a, c, b, e]
          */
          
         //iterator()是为了各种集合的实现类能有一个统一的遍历方式
            Iterator iterator = map.keySet().iterator(); //keySet() 返回此映射中包含的键的 Set 视图。
              //iterator()返回在此 set 中的元素(这里是key值)上进行迭代的迭代器。         
            while (iterator.hasNext()) {
             Object key = iterator.next();
             System.out.println(key);
             System.out.println("map.get(key) is :"+map.get(key));
             
            }      
           
           
           
           
                 
                     
        
       }
    
}
为什么会出现这种错误啊 一开始调试的时候还行的啊
在没加入System.out.println(map.size());这句话之前还行的啊 加入之后将他注释也不行
我用的是jcreator  
--------------------Configuration: <Default>--------------------
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)where options include:
    -client   to select the "client" VM
    -server   to select the "server" VM
    -hotspot      is a synonym for the "client" VM  [deprecated]
                  The default VM is client.
                  
    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A ; separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose[:class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -jre-no-restrict-search
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertionsProcess completed.