I need to assign a value to my 2 Dimension array.
I tried to code as below, but I get NullPointer Exception Error.
MethodClass[][] methodSet = new MethodClass[1][1];
methodSet[0][0].setmethodName(1);
methodSet[0][1].setmethodStatus(1);
The MethodClass
file:
public class MethodClass {
private int methodName;
private int methodStatus;
public MethodClass() {
methodName = 0;
methodStatus = 0;
}
public int getmethodName() {
return methodName;
}
public int getmethodStatus() {
return methodStatus;
}
public void setmethodName(int i) {
this.methodName = i;
}
public void setmethodStatus(int status) {
this.methodStatus = status;
}
}
May I know how to initialize the value to 2 dimension array?