I am new to this forum and Java. The code below compiles but when I try enter a value to a variable I get NullPointerException. What is wrong?
class output_harm
{
public int[] timestamp;
public int[] state;
public output_harm(){
timestamp = new int[8];
state = new int[8];
}
}
output_harm[][] outputs = new output_harm[7][6];
outputs[0][0].state[0] = 0; //java.lang.NullPointerException
nullin this case. populate it first before accessing it.