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! While you're at it, check out some resources Treehouse students have shared here.
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 trialahmed alghafli
3,446 PointsWhen I run my app it is work fine but I couldn't get the random number 0 1 2 instate i get java@ some number.???
please tell me if I did something wrong !!
ahmed alghafli
3,446 Pointsthanks I forgot out how to solve it
Alex S
Courses Plus Student 1,056 PointsI am getting the same thing. My code is [CODE] public void onClick(View v) { //The button was clickes, so update the fact label with a new fact. String fact = ""; //Randomly select a fact Random randomGenerator = new Random(); //construct a new Random number generator int randomNumber = randomGenerator.nextInt(3); fact = randomGenerator + ""; //Update the label with our dynamic text factLabel.setText(fact); } [/CODE]
Alex S
Courses Plus Student 1,056 PointsNever mind. I just figured it out. I was accidentally calling randomGenerator instead of randomNumber at the end.
1 Answer
Jordan Bar
Courses Plus Student 405 PointsMake sure you wrote down that fact = randomNumber and not randomGenerator
Zahscha Gonzalez
27,775 PointsZahscha Gonzalez
27,775 PointsCan you post your code?