Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Forums
Register
Login
Java
»
Beginning Java
Displaying others variables in a String
Peter Shipway
,
Ranch Hand
Jun 02, 2004 22:50:00
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
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
Jun 02, 2004 23:03:00
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
line = "" + n;
or
line = n + "";
or
line = Integer.toString(n);
Richard Bradford
,
Ranch Hand
Jun 03, 2004 04:16:00
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
OR
line = String.valueOf(n);
Which also works with other primatives such as boolean, char etc
Post by:
autobot
Stop it! You're embarassing me! And you are embarrassing this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
This thread has been viewed 828 times.
Similar Threads
how to parse this string ?
UPloading a Big file
labels, breaks, and continue questions
Collection with 3 keys
Garbage Collection
More...
All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 08:05:24
.