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 trialDavid Hume
10,334 PointsI'm getting this error when I try to run my code: Error:(35, 55) error: package randomGenerator does not exist
Here's the code: public void onClick(View v) { //the button was clicked - update TextView with new fact String fact = ""; //RANDOMLY SELECT A FACT //first IMPORT class: Random randomGenerator = new Random(); //create variable to store randomly generated number: int randomNumber = new randomGenerator.nextInt(3); fact = randomNumber + ""; //update screen with dynamic fact
mFactTextView.setText(fact);
}
};
2 Answers
Kourosh Raeen
23,733 PointsDo you have the following import statement?
import java.util.Random
David Hume
10,334 PointsI found my mistake. Typo. Had an extra "new" in code.