- public class AddWords
- extends Object
This class is used to control the adding of new words to the word list.
It accepts input from stdin (typically the keyboard). If a word is at least
three characters long it attempts to insert it into the word list. If the
word already exists nothing happens, otherwise it is added to the list.
If a word of two or fewer characters is entered, then the current word list
is saved to a file.
The default creator.
|Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
- The default creator. Sets class variables to default values.
public void populateWordList(String fileName)
- Controls the population of the class's word list. This is done by
creating the object which will hold the list and then calling a method
to populate the object.
fileName - The name of the file that contains the word list
true if the word list is successfully populated,
public void getWordsFromStdin()
- Gets words from stdin. Reads a character at a time until an end of line
or form feed is read, which signifies the end of a word. If the word is
at least three characters long it is added to the word list.
public static void main(String args)
- Controls the running of the AddWords class. Reads in the current word
list, then calls getWordsFromStdin to allow the user to enter new words
into the word list.