Need Help On Last Task!
when I run this code it keeps giving me an error where it says int can not be converted into string? So please someone help me!
Random randomGenerator = new Random(); int randomNumber = randomGenerator.nextInt(10); String intAsString = ""; intAsString = (10);
Suleyman OrazgulyyevPro Student 5,797 Points
You are declaring a string "intAsString" and you are assigning 10 to it. Either you have to cast it, or use a method:
Rafael Miranda17,121 Points
I would do like this...
Random randomGenerator = new Random(); int randomNumber = randomGenerator.nextInt(10); String intAsString = String.valueOf(10);
Steve HunterTreehouse Moderator 57,566 Points
The challenge is looking for you to use a moosh, i.e. adding a blank string to an integer to create a string*of* that integer.
String intAsString = randomNumber + "";
I hope that helps,