wood burning stoves*
The moose likes Beginning Java and the fly likes Displaying others variables in a String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Displaying others variables in a String" Watch "Displaying others variables in a String" New topic
Author

Displaying others variables in a String

Peter Shipway
Ranch Hand

Joined: Mar 25, 2004
Posts: 71
How do you convert a variable to a string? eg if i have

String line;
int n = 0;

how can i make it so that line = "0"?
Mani Ram
Ranch Hand

Joined: Mar 11, 2002
Posts: 1140

or

or


Mani
Quaerendo Invenietis
Richard Bradford
Ranch Hand

Joined: Apr 20, 2004
Posts: 48
OR

line = String.valueOf(n);

Which also works with other primatives such as boolean, char etc
 
wood burning stoves
 
subject: Displaying others variables in a String
 
Similar Threads
Collection with 3 keys
Garbage Collection
how to parse this string ?
UPloading a Big file
labels, breaks, and continue questions