I want to enter a random number generated by a function to an array of objects, the problem is that when I want to enter it, it sends me an error, here the code: (I have a class called "Processes" where are the getters and setters methods)
package roundrobin;
/**
*
* @author george
*/
public class RoundRobin {
public static int numale() {
int numale = 0;
numale = (int) (Math.random() * (25 - 4 + 1) + 4); //Numeros aleatorios desde 4 hasta 25
return numale;
}
public static void main(String[] args) {
Procesos pro[] = new Procesos[15];
pro[0].settempllegada(numale()); //linea 19
System.out.println(pro[0].getllegada());
}
}
And this is what I get when I execute:
Exception in thread "main" java.lang.NullPointerException
at roundrobin.RoundRobin.main(RoundRobin.java:19)
/home/george/.cache/netbeans/8.2/executor-snippets/run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)