Hallo,
ich habe eine komische Null Pointer Exception, die bei der Verwendung der Hashmap auftaucht. Mein Code:
Was könnt die Ursache der Null Pointer Exception sein? Es wurde doch die HashMap erzeugt? Könnt ihr mir vielleicht weiterhelfen?
ich habe eine komische Null Pointer Exception, die bei der Verwendung der Hashmap auftaucht. Mein Code:
Java:
public class tryout{
HashMap<String, Integer> hashmapp;
public tryout(){
hashmapp = new HashMap<String, Integer>();
}
public void addtohashmap(){
hashmapp.put("x", 0);
}
}