What is causing Null Pointer Exception in the following code in java? [migrated]
- by Joe
When I run the following code I get Null Pointer Exception. I cannot figure out why that is happening. Need Help.
public class LinkedList<T> {
private Link head = null;
private int length = 0;
public T get(int index) {
return find(index).item;
}
public void set(int index, T item) {
find(index).item = item;
}
public int length() {
…