[Solved]-Trying Insert Strings Hash Table Read File Isn T Outputting Correctly Use Scanner User Inp Q37240357
I am trying to insert strings into a hash table read from afile, but it isn’t outputting correctly. If I use Scanner userinput it works just fine, but reading from a file isn’tworking.
This is the code:
import java.io.*;
public class HashTest {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(newFileReader(“C:UsersJaredDocumentsCS265 JavaLab 15HashTable.txt”));
HashTable table = new HashTable();
String str = “”;
while ((str = br.readLine()) != null) {
table.insert(str);
}
br.close();
System.out.println(“Hash Table:”);
table.displayTable();
}
}
Im pretty sure my Hash Table class used for this main is correctand its just the issue of reading from a file. Please let me knowif there’s something I’m doing wrong, or if I need to provide myHash Table class.
Expert Answer
Answer to I am trying to insert strings into a hash table read from a file, but it isn’t outputting correctly. If I use Scanner us… . . .
OR

