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
You have to import the class first. Add
import java.util.Random; at the top of your code.