/* * WordCount.java * Created on Feb 24, 2005 */ package word; /** * A pairing of a word and a count that can be incremented. */ public class WordCount { private final String word; private int count = 1; public WordCount(String word) { this.word = word; } public void incrementCount() { ++count; } public String word() { return word; } public int count() { return count; } public String toString() { return word + " (" + count + ")"; } }