Asked By
milodiaz
10 points
N/A
Posted on - 03/15/2012
I make a simulation using IDE NETBEANS but there is a warning:Â Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
on source code :
if(!mapRouter.containsKey(routerA))
addRouter(routerA);
Anybody know how to finish it?
Need some help about Java
Null Pointer Exception is normally thrown when a NULL value is somehow assigned. For example, there may be no RouterA to add. This is a simple thing, wherever you get such problem, you need to use null OBJECTS INSTEAD OF ONLY null. The another wayout is to check using a if-else construct for NULL values. This helps in overcoming the error.Â
You may submit the rest of the code for us to debug. Only two lines of code is not enough to identify the problem. So, please try out the above and if not overcome, post the entire code.Â
Thanks.