Hi so I have a class that has mulitple layers of nested classes within it and I was wondering why it does not work. For some reason I cant create a new StackNode I was wondering why that might be.
public class MultiStack {
Stack1[] arr;
int lim,numplate,index;
MultiStack(int limit, int total) {
lim = limit;
numplate = total;
int ssize =0;
if(total%lim==0) {
ssize = total/lim;
} else {
ssize = (total/lim) +1;
}
arr = new Stack1[ssize];
}
class Stack1 {
StackNode top;
int size;
class StackNode{
StackNode next;
int value;
}
}
public void push(int value){
if(arr[index].size < lim) {
push1(index);
}
}
public void push1(int index) {
arr[index].size++;
StackNode cur = new StackNode(); //here is my issue
cur.next = arr[index].top;
arr[index].top = cur;
}
}