Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Displaying others variables in a String

 
Peter Shipway
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

or

or
 
Richard Bradford
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OR

line = String.valueOf(n);

Which also works with other primatives such as boolean, char etc
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic