File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Null pointer not found Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Null pointer not found" Watch "Null pointer not found" New topic
Author

Null pointer not found

Swamy Nathan
Ranch Hand

Joined: May 16, 2004
Posts: 187
Ok somebody explain this-

output:
john von
Ranch Hand

Joined: Apr 13, 2004
Posts: 49
explain what?
Swamy Nathan
Ranch Hand

Joined: May 16, 2004
Posts: 187
If the following throws java.lang.NullPointerException
s=null;
s=s.concat("a");

How come this
("1"+null+2) does not?

And also in other places.

Am I correct in thinking this is because internally a StringBuffer is used in all cases and stringBuffer.append(null) just adds the text null.
Anyway I thought it was interesting because I was expecting a nullpointer to be thrown and it was not.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Null pointer not found
 
Similar Threads
immutable?????????
Question on Strings and String pool
HOW MANY OBJECTS ARE CREATED
String object
Static and Instance Blocks..