| 1 | class User { |
| 2 | private final String name; |
| 3 | private int bestWpm; |
| 4 | |
| 5 | User(String name, int bestWpm) { |
| 6 | this.name = name; |
| 7 | this.bestWpm = bestWpm; |
| 8 | } |
| 9 | |
| 10 | void updateBest(int latestWpm) { |
| 11 | if (latestWpm > bestWpm) bestWpm = latestWpm; |
| 12 | } |
| 13 | |
| 14 | @Override |
| 15 | public String toString() { |
| 16 | return name + " (best: " + bestWpm + ")"; |
| 17 | } |
| 18 | |
| 19 | public static void main(String[] args) { |
| 20 | User user = new User("Ava", 75); |
| 21 | user.updateBest(82); |
| 22 | System.out.println(user); |
| 23 | } |
| 24 | } |
nothing calls this directly
no outgoing calls
no test coverage detected