public class Main {
public static void main(String[] args) {
Lottery nums = new Lottery();
System.out.print(nums.getLotteryNumbers());
}
}
class Lottery {
int[] lotteryNumbers;
Lottery() {
Random randomNum = new Random();
int[] lotteryNumbers = new int[6];
for (int i = 0; i < lotteryNumbers.length; i++) {
lotteryNumbers[i] = randomNum.nextInt(10);
}
}
public int[] getLotteryNumbers() {
return lotteryNumbers;
}
}
I get a null every time I try to print out my Random array, if you can please point me to what I'm doing wrong I'd really appreciate it thanks!
Aucun commentaire:
Enregistrer un commentaire