|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectWordCount
public class WordCount
This class stores a word and a count representing the number of times the word appears in a document.
Field Summary | |
---|---|
private int |
count
|
private java.lang.String |
theWord
|
Constructor Summary | |
---|---|
WordCount(java.lang.String theWord)
Constructor takes as input the word and initializes the count to 0. |
Method Summary | |
---|---|
int |
getCount()
Return the count. |
java.lang.String |
getWord()
Return the word. |
void |
increment()
The increment method adds one to the count. |
java.lang.String |
toString()
Returns a string representation of the object in the form: Word: theWord Count: count |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.lang.String theWord
private int count
Constructor Detail |
---|
public WordCount(java.lang.String theWord)
theWord
- Method Detail |
---|
public void increment()
public java.lang.String getWord()
public int getCount()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |