i am trying to call a method to generate a random number, but Java won't let me. It is telling me to create a method even though i already have. Here is my code.
package hw3;
import java.util.Random;
//Zephram Foster, Homework 3, 10-12
public class randomLottery {
int num[];
int ball;
int high;
public static int generateRandomInt(int upperRange){
Random random = new Random();
return random.nextInt(upperRange);
}
}
package hw3;
import java.util.Scanner;
public class randomMain {
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter the high number: ");
//int high = sc.nextInt();
//System.out.println(high);
randomLottery rand = new randomLottery();
rand.high = sc.nextInt();
System.out.println(rand.high);
rand.num[1] = generateRandomInt(rand.high);
}
}
the problem is in the main class, the last line. Please help my dudes