MCPcopy Create free account
hub / github.com/ShivaBhattacharjee/KeyZen / User

Class User

data/java/02_oop.java:1–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1class 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected