谁看下我的代码,错在哪?链表加数组
程序代码:
//我想弄个链表加数组的数据模式,但是代码终出错 public class NodeTest { private final static int size = 10 ; private static Node node = new Node(size ,null ,null ); private int low = 0 ; private Node nextnode = node ; public NodeTest() { node.next = node.previous = node; } public Node addBeforen() { nextnode = new Node(size,node,node.previous); nextnode.next.previous = nextnode; nextnode.previous.next = nextnode; low = 0; return nextnode; } public Boolean add(String a) { if(low+1>size) addBeforen(); nextnode.date[low++] = a ; return true; } public static void main(String[] agrs) { NodeTest test = new NodeTest(); for(int i = 0 ;i < 20; i++) test.add("a"); System.out.println(test); } } public class Node { String []date ; Node next; Node previous; public Node( int date , Node next, Node previos) { this.date = new String [date]; this.next = next; this.previous = previous; } }想弄个数组加链表的数据结构,但是总是出错。谁能看下问题在哪里?