That was my bailout strategy. I wanted to do it shorter. I still don't get why it doesn't work. result[0] is a legal address of the first Hashmap, right? Sow why can't I "put" anything there? Thanks anyway!
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18652
posted
0
Again, we need to see more code. There must have been some other lines between HashMap[] result = new HashMap[5]; and result[0].put("name", new String("The Name")); or you would have gotten a NullPointerException. You need to show us the actual code you're using here, in order to get an explanation. Or if this really is the code you're looking at, then delete your .class file and recompile. If that doesn't work, study your class path carefully and look for a .class or .jar file in another directory which is getting run instead of the class you're trying to execute. One way or another, you're not running the code you show above. [ February 16, 2003: Message edited by: Jim Yingst ]
"I'm not back." - Bill Harding, Twister
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9001
posted
0
result[0] is a legal address of the first Hashmap, right?
result[0] is not a legal address until you initialize it. You've declared it, but you have not initialized it. Therefore, you should be getting a NullPointerException, as Jim and Thomas have already pointed out.