System.out.println("5" + null); System.out.println(5 + null); I get 5null for both the statements. I cannot even compile when I use *, /, % or - operators in the second statement. I understand that when one of the operands is a String in a binary + expression, the other operand is made a String object and a String concatenation happens. But with null...!!! Please explain [ July 22, 2002: Message edited by: Madan, Gopal ]
Now only reference values need to be considered. If the reference is null, it is converted to the string "null" (four ASCII characters n, u, l, l). Otherwise, the conversion is performed as if by an invocation of the toString method of the referenced object with no arguments; but if the result of invoking the toString method is null, then the string "null" is used instead.
Bindesh, How does your statement and your example differ from Valentin's statement? Is it possible that you have made similar statements?
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
Bindesh Vijayan
Ranch Hand
Joined: Aug 21, 2001
Posts: 34
posted
0
Yes I have made similar statement as that of Valentins with the exception of JLS being transformed to an easy example to make it more easy to understand. Thanks Bindesh Vijayan
Bindesh Vijayan
Ranch Hand
Joined: Aug 21, 2001
Posts: 34
posted
0
Yes I have made similar statement as that of Valentin's with the exception of JLS being transformed to an easy example to make it more easy to understand. Thanks Bindesh Vijayan
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.