im readin from a file in main and in main i store ticks as a variable then i pass it to linkedList.insertNode() then it goes to the Node class and the values are set and when i call the linkedList.printAll(); from main i get a NULLPOINTEREXCEPTION and i dont understand why. Am i not printing ticks value? List Snippet
class List{
private Node ptr;
private int ticks;
private int jobId;
private String name;
public List(){
ptr = null;
}
public void insertNode(int t,int j, String name){
Node node = new Node(t,j,name);
if(ptr == null){
node.next = node;
node.prev = node;
}//end if
public void printAll(){
System.out.format("%d",ptr.getTicks());
}
Node Spippet
class Node{
private int ticks;
private int jobId;
private String name;
Node next;
Node prev;
public Node(int t,int j, String name){
this.ticks = t;
this.jobId = j;
this.name = name;
setNext(null);
}
MAIN(snippet)
linkedList.insertNode(ticks,jobId,name);
linkedList.printAll();