File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Programmer Certification (SCJP/OCPJP)
Joined: Aug 31, 2005
Dec 26, 2005 10:58:00
Here why it is throwing null point exception.
as we know that strings are immutable so there is no change in
so why it is not printing null.
but if i remove /////1 and //////2 then it prints null.
public class NULL
public static void main (String args)
String a = null;
Joined: Feb 07, 2005
Dec 26, 2005 11:20:00
In lines 1 and 2, you are trying to call a method on an object reference which is null.
If you take out those lines, you get the String representation of null.
It is sorta covered in the
JavaRanch Style Guide
concat 2 strings using constructor
String concat() question required
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014