import java.util.Random; // Needed for the 'Random' class (method #1) public class RandomNumbers { // This class shows two different methods of // generating a random integer from 0 to 9 public static void main(String[] args) { // Method #1 Random randNum = new Random(); int randNum1 = randNum.nextInt(10); System.out.println(randNum1); // Method #2 int randNum2 = (int) (Math.random() * 10); System.out.println(randNum2); } }