Ask coding questions

← Back to all posts
[Java] Can anyone help me?
MisledWater79

My code is giving a error and i don’t know what to do to fix it. I’m try to make something that saves a id and class in a hashmap. It’s throwing this error run it runs:
Exception in thread “main” java.lang.NullPointerException at Main.main(Main.java:14)

Voters
MisledWater79
Comments
hotnewtop
Coder100

look at this: you never defined the variable, you only set it a type.