I tried to create an array of Random Numbers between 1 to 10 but I am getting a compilation Error. Can anyone tell me what's going wrong in my code?
import java.util.*;
public class Random {
public static void main(String args[]){
int arr[] = new int[1000];
int num;
Random rand = new Random();
for (int i = 0; i <=arr.length; i++){
num = 1+ rand.nextInt(10);
arr[i] = num;
System.out.println("Random No. Index: "+i+"\t Value : "+arr[i]);
}
}
}