I've searched all of over SO but I haven't quite found exactly what I'm looking for because it's overly complicated. I want to know why I'm getting this error (posted below). My code seems logically correct but for reason I'm getting the null pointer exception.
Here's my HashTable.java
file:
import java.util.*;
public class HashTable {
public static void lastFourDigitsStudent(Student s) {
LinkedList<Student>[] llStudent = new LinkedList[1000];
String a = s.getId().substring(4,8);
int lastFourDigits = Integer.parseInt(a);
int hashFunction = lastFourDigits % 1000;
llStudent[hashFunction].add(s);
}
}
Here's the error
I'm getting:
Type safety: The expression of type LinkedList[]
needs unchecked conversion to conform to LinkedList<Student>[]