When I compile my code, I get the following:
Display ommitted hash table:
Exception in thread "main" java.lang.NullPointerException
at Hash.display_hash_table(Hash.java:268)
at Driver.main(Driver.java:20)
Here are the relevant portions of code:
public void display_hash_table()
{
System.out.println("Display ommitted hash table: ");
pw.append("Display ommitted hash table: \n");
for (int i = 0; i < table.length; i++) {
System.out.println(String.valueOf(i) + "\t" + table[i].getData());
pw.append(String.valueOf(i) + "\t" + table[i].getData() + "\n");
}
System.out.println("The total number of probes is: " + String.valueOf(this.count_probe) + "\n");
pw.append("The total number of probes is: " + String.valueOf(this.count_probe) + "\n");
}
and
omitted_words.display_hash_table();
Does anyone have any suggestions on what could possibly be my error? Thank you!