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

Jorge Ponce
Jorge Ponce
2,003 Points

help i dont now whathappend

help with this i use the keyword

RandomTest.java
Random randomGenerator = New Random ();
int randomNumber = randomGenerator.nextInt(facts.length);
fact = facts [randomNumber];

2 Answers

Jason Wiram
Jason Wiram
Full Stack JavaScript Techdegree Student 41,151 Points

Challenge one: Don't do more than the challenge asks. Your first line is close. "New" should not be capitalized though. I would also advise not adding a space between your class/object and method - example: Random().

Two: Your randomNumber variable should be created using nextInt(). "Facts" from the videos has nothing to do with this challenge.

Three: When limiting the range of your randomNumber, use a number (not a variable that doesn't exist in this challenge).

Four: Create a string named as required in the instructions and use string concatenation (like in the lessons) to convert your number to as string.

Random randomGenerator = new Random();
int randomNumber = randomGenerator.nextInt(10);
String intAsString = randomNumber + "";
james south
james south
Front End Web Development Techdegree Graduate 33,252 Points

just do exactly what the challenge asks. this code is close but not exactly right. firstly, the keyword is new, not New. also, there is no reference to anything called facts in the challenge.