How can I generate random integers and then print them?
I have tried the following code,but it does not compile.
import java.util.Random;
class Random
{
Random rand = new Random();
int num=rand.nextInt(40);
System.out.println(num);
}
You should use unique class names unless you feel like referring to the different
Randoms by their full package titles.Save the above as
MyRandom.java, then do a;