Skip to main content

Beginner programming question

2 replies [Last post]
downthesun01
Offline
Joined: 2007-10-18

How can I convert a random int into a string?

For example,

Random value = new Random();

int x = value.nextInt();

// How would I go about converting the value of variable x from a random integer into a String? Thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kirillcool
Offline
Joined: 2004-11-17

1. This is a java desktop forum. If you're new to Java, post your questions at [1]
2. Use Integer.toString(int) static method
3. Use "" + myInteger

[1] http://forum.java.sun.com/forum.jspa?forumID=54

downthesun01
Offline
Joined: 2007-10-18

I'm sorry. I thought I was in the right forum. Thanks for the help though and the link.