Skip to content

Commit ca59c97

Browse files
committed
Improved Hero#toString.
1 parent 62b8717 commit ca59c97

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

builder/src/main/java/com/iluwatar/Hero.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public Weapon getWeapon() {
4242
public String toString() {
4343

4444
StringBuilder sb = new StringBuilder();
45+
sb.append("This is a ");
4546
sb.append(profession);
4647
sb.append(" named ");
4748
sb.append(name);
@@ -62,7 +63,7 @@ public String toString() {
6263
sb.append(armor);
6364
}
6465
if (weapon != null) {
65-
sb.append(" and wielding ");
66+
sb.append(" and wielding a ");
6667
sb.append(weapon);
6768
}
6869
sb.append(".");

0 commit comments

Comments
 (0)