Android Build a Simple Android App Basic Android Programming Using the Random Class

Hans Henrik Nielsen Hansen
PRO
Hans Henrik Nielsen Hansen
Pro Student 454 Points

converting integer to string value

The last test question wants me to convert the integer into a string variable by adding two values.

RandomTest.java
Random randomGenerator = new Random();
int randomNumber = randomGenerator.nextInt(facts.length);
String[] intAsString = {
                        randomNumber };
Hans Henrik Nielsen Hansen
Hans Henrik Nielsen Hansen
Pro Student 454 Points

Here's the challenging question. I cannot figure out how to do. :/ "Create a String variable named intAsString. Convert the randomNumber integer to a String value and store it in the intAsString variable. Hint: Add them together like in the video!"

1 Answer

Fahad Mutair
Fahad Mutair
10,354 Points
Random randomGenerator = new Random();
int randomNumber = randomGenerator.nextInt(10);
String intAsString = randomNumber + "";

is it possibile that does not work for me?