|
ShinAli posted:This. A tip to spot these kind of problems right away is using a debugger in Eclipse or NetBeans. They both will display all visible variables and indicate their value, which makes "NullPointerException" easier to deal with on multi statement line of code. A further tip: In eclipse there is a button in the breakpoints pane to add breakpoints when exceptions occur. Add one to java.lang.NullPointerException
|
# ¿ Apr 21, 2008 19:19 |
|
|
# ¿ Apr 27, 2024 13:06 |
|
ignorant slut posted:Quick Java NullPointerException question... Use debug mode and breakpoints in whatever IDE you are running and you should be able to work out any NullPointer. Anyway... I've not ran your code but after a quick look it looks like you've not instantiated your HashMaps. HashMap<Integer, Dorm> dorms; should be Map<Integer, Dorm> dorms = new HashMap<Integer, Dorm>(); You've done this with the other Maps in other classes as as well. Anyway I think you've misunderstood what HashMaps are for here. They are like a dictionary, IE store Key Value pairs. From your code, it looks like you don't want to do this as you are just using sequential numbers as keys. In this instance just use an ArrayList for holding your dorms, floors and students: List<Dorm> dorms = new ArrayList<Dorm>(); standard fucked around with this message at 21:19 on Sep 6, 2008 |
# ¿ Sep 6, 2008 20:59 |
|
Repeating this because your quoted me before I edited: Anyway I think you've misunderstood what HashMaps are for here. They are like a dictionary, IE store Key Value pairs. From your code, it looks like you don't want to do this as you are just using sequential numbers as keys. In this instance just use an ArrayList for holding your dorms, floors and students: List<Dorm> dorms = new ArrayList<Dorm>(); It looks like you are making a decent stab at this so I don't mind chatting to you on MSN (Sorry I'm from the UK and no one uses AIM) if you have any more questions. I won't do your homework for you mind... Email me your MSN from my profile if you want.
|
# ¿ Sep 6, 2008 21:26 |
|
duck monster posted:Anyone have any idea when the website for Hibernate will be back up? Its been down for a bit now, and its a bit frusturating that I need to learn how to use it, but all the documentation is on a website that just says "Down for maintainance. Back up soon" or thereabouts. The docs are included in the latest distro, so just download that.
|
# ¿ Apr 23, 2009 15:32 |
|
Window -> Preferences -> Java -> Compiler -> Compiler Compliance level.
|
# ¿ Apr 30, 2009 22:25 |