java程序问题求助??
这是我编的一个java链表,但是在调试时总是出现以下提示:import java.io.*;
import java.lang.*;
public class Lisk1{
private Node Head=null;
private Node Tail=null;
private Node Pointer;
private int Length=0;
void insert(Lisk1 a,Node e)
{
a.Length++;
if(a.Length==1)
{
a.Head=e;
a.Tail=a.Head;
a.Pointer=a.Head.next;
}
else
{
a.Tail.next=e;
a.Tail=e;
a.Pointer=e.next;
}
}
void output(Lisk1 a)
{
a.Pointer=a.Head;
for(int i=1;i<=a.Length;i++){
System.out.print(Pointer.data+" ");
a.Pointer=a.Pointer.next;
if(a.Pointer==null)
throw new java.lang.NullPointerException();
}
}
void delete(Lisk1 a,int j){
int i=1;
a.Pointer=a.Head;
if(j==1){
System.out.println("The chracter is"+" "+a.Pointer.data);
a.Head=a.Pointer.next;
}
else
{
while(i!=j-1)
{
a.Pointer=a.Pointer.next;
i++;
}
System.out.println("The chracter is"+" "+a.Pointer.next.data);
if(j==10)
a.Tail=a.Pointer;
a.Pointer=a.Pointer.next.next;
}
}
public static void main(String[] args){
int i;
int j=2;
Lisk1 a=new Lisk1();
for(i=0;i<10;i++){
Node e=new Node(new Integer(i));
a.insert(a,e);
}
System.out.println("Please output the characters of link:");
a.output(a);
System.out.println("Please delete the index");
a.delete(a,j);
}
}
class Node{
Object data;
Node next;
public Node(Object d){
data=d;
next=null;
}
}
提示:Exception in thread "main"java.lang.NullPointerException at Lisk1.output<Lisk1.java:31>
at Lisk1.main<Lisk1.java:64>
望各位人兄帮帮忙!!!!