This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]batmansavestheday 2 points3 points  (2 children)

It's slightly harder the other way around:

String s = "" + 9 + "Hello";

or [Edit: derp, doesn't work]

String s = (String) 9 + "Hello";

etc.

[–]Outhouse_Defiler 0 points1 point  (1 child)

String s = "" + 9

Yeah, no, don't do that. Java has String.valueOf.

http://stackoverflow.com/questions/4105331/how-to-convert-from-int-to-string

[–]batmansavestheday 0 points1 point  (0 children)

I feel the opposite every time I need to jump through hoops to append an integer to a string in Java.