Professional Documents
Culture Documents
hill
fetch
pail
water
up
down
crown
Meanwhile, Jill starts coding the Java dictionary object. She uses a very
straightforward approach. When the Dictionary0 object is created, it will read in
the words from the file words.txt and store them in the Vector called "words." A
Vector is a variable-length list of items (Example 1-2).
import java.io.*;
import java.util.*;
class Dictionary0 {
Vector words = new Vector();
Dictionary0() {
loadWords();
}
void loadWords() {
try {
BufferedReader f = new BufferedReader(