Reputation: 191
I have the following code:
public class Table {
Table2[] data = new Table2[2000];
public Table() {
for (int i = 0; i < data.length; i++) {
data[i] = new Table2();
}
}
}
And:
public class Table2 {
Integer[] data;
public Table2() {
data = new Integer[100];
}
Im having problems accessing Table.data[0].data[0]
Table.data[0].data[0] is not null.
The program works in Eclipse but outside of Eclipse i get a NoSuchField error. Im not sure how to fix this.
Upvotes: 0
Views: 60
Reputation: 79480
You must be doing some typo/mistake in your code accessing it. If you do it as follows, no matter where (eclipse or outside) you are accessing it, the result will be same.
public class Main {
public static void main(String[] args){
Table table=new Table();
table.data[0].data[0]=10;
System.out.println(table.data[0].data[0]);
}
}
Output:
10
Upvotes: 1