No of visitors who read this post:
199
Category:
Prog\Scripting Languages
Type:
Question
Author:
Milodiaz
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?
- Login or Signup Now to post comments

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, whereever 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 overcomed, post the entire code.
Thanks.