HashMap in java ?

public NumberNames(){

private HashMap map =new HashMap<String,Integer>();

publicvoid put(String name,int value){ map.put(chuchu, 9);}

public Set getNames(){

return map.keySet();

}

}

publicstaticvoid main(String[] args)

{

NumberNames n =new NumberNames();

}

}

Output

D:\>javac NumberNames.java

NumberNames.java:4: illegal start of expression

private HashMap map = new HashMap<String,Integer>();

^

NumberNames.java:5: illegal start of expression

public void put(String name, int value){ map.put(name,value); }

^

NumberNames.java:9: ';' expected

}

^

3 errors

[1357 byte] By [Tatona] at [2007-10-3 3:04:39]
# 1
This is nothing to do with HashMap. You are missing the word "class" from your class declaration.
dannyyatesa at 2007-7-14 20:54:41 > top of Java-index,Core,Core APIs...