AmericanLand
asked on
Java.lang.nullpointerexception
What is the fix for this error
please give the stack trace
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> Shiva shiva=NULL;
Should be
Siva shiva = null;
;-)
Should be
Siva shiva = null;
;-)
it can also be
RAdarsh radarsh = null;
..
..
..
while(true)
{
if(radarsh!=null)
radarsh=null;
}
Oops that was a Typo in my case.Any way thanks for correcting radarsh But i think only NULL must be null, no need of changing the class name from Shiva to Siva.
;-)
Bye.
RAdarsh radarsh = null;
..
..
..
while(true)
{
if(radarsh!=null)
radarsh=null;
}
Oops that was a Typo in my case.Any way thanks for correcting radarsh But i think only NULL must be null, no need of changing the class name from Shiva to Siva.
;-)
Bye.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Other examples with arrays :
int[] counters; // == null (not allocated)
couters[0]
->
int[] counters = new int[10];
Object[] objects=new Object[10]; // array allocated, but elements are null
objects[0].toString(); // objects!=null objects[0]==null
->
objects[0] = new Object();
int[] counters; // == null (not allocated)
couters[0]
->
int[] counters = new int[10];
Object[] objects=new Object[10]; // array allocated, but elements are null
objects[0].toString(); // objects!=null objects[0]==null
->
objects[0] = new Object();
Guys, let's wait for the questioner to post some kind of stack trace now.
________
radarsh
________
radarsh
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That is from http://www.akadia.com/services/java_exceptions.html, isn't it :) ?
ASKER