Link to home
Start Free TrialLog in
Avatar of AmericanLand
AmericanLand

asked on

Java.lang.nullpointerexception

What is the fix for this error
Avatar of AmericanLand
AmericanLand

ASKER

I need to find a fix for this error
please give the stack trace
ASKER CERTIFIED SOLUTION
Avatar of geekprog
geekprog

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Siva Prasanna Kumar
Siva Prasanna Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>> Shiva 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.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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();

Guys, let's wait for the questioner to post some kind of stack trace now.

________
radarsh
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial