jpking72
asked on
Hashtables
I have 4 tables to construct. Can I make arrays of hashtables? What is the best way to deal with this data? Do I make one hashtable per table then store the keys and values as Arrays? How do I do this?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hashtable[] ht = new Hashtable[50];
Hashtable[] ht2 = new Hashtable[50];
Hashtable[] ht3 = new Hashtable[50];
String a;
String POS[] = {"<s>","VB","TO","NN","PPS
double num;
try {
FileReader fr = new FileReader(args[0]);
BufferedReader br = new BufferedReader(fr);
for (int i = 0; i < 6; i++)
{
a = br.readLine();
StringTokenizer st = new StringTokenizer(a, " ");
int j = 0;
while(st.hasMoreTokens()) {
num = Double.parseDouble(st.next
ht[i].put(POS[j],new Double(num)); <---------------------- this line gives a null pointer exception
j++;
} // end of while
}// end of for
} // end of try
catch(Exception e) {
System.out.println("Except
}