please format code with </> button * homework policy * asking questions
there is a Random class showed on the book , but when I wrote code like this , the console showed me it cannot find a class named Random .
please format code with </> button * homework policy * asking questions
there is a Random class showed on the book , but when I wrote code like this , the console showed me it cannot find a class named Random .
The hint is in the text. Random-class is in Java standard library and to use it you need to first import it, so add a line at very start import java.util.Random;
You have to import the class first. Add import java.util.Random;
at the top of your code.