Nullpointer Exception

What is Nullpointer Exception How it will be reduced

Questions by vijayramd

Showing Answers 1 - 6 of 6 Answers

I can give you example
 if you create string array and you not assing any value for that string object. 
when you want print this array  the JVM give Null pointer Exception              

  Was this answer useful?  Yes

abuthahir.d

  • Apr 14th, 2008
 

There are many reasons to get a Null pointer Exception .

Burn it in ur Brain : NullPointerException can occur only on OBJECTS . not primitives.

the above said answer holds a good example .

Example 2:
 String s = null;
  System.out.println(s.concat("asdad") ); 
will throw NullPointerException . This happens because we are trying to ivoke a methos in a null Object .

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions