A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Refactoring for Software Design Smells: Managing Technical Debt
this week in the
OO, Patterns, UML and Refactoring
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.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
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-2015