Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
There is a compiler error. Please click on preview to view your syntax errors!
I entered in “intAsString = randomNumber + “”; but I am getting a “There is a compiler error. Please click on preview to view your syntax errors! “ I checked the preview but do not understand what I have done wrong any ideas?
Random randomGenerator = new Random(); Int randomNumber = randomGenerator.nextInt(10); intAsString = randomNumber + "";
That's a new error caused because you've not declared
intAsString to be a String. Add the word
String before it:
String intAsString = randomNumber + "";
That should sort it for you.
You should change
int as you declare the
randomNumber variable - that one letter could be causing the problems you're experiencing!
int randomNumber = randomGenerator.nextInt(10);
Random randomGenerator= new Random(); int randomNumber = randomGenerator.nextInt(10); String intAsString = randomNumber +"";