Improved Hero#toString.

This commit is contained in:
Ilkka Seppala 2015-03-23 21:49:18 +02:00
parent 62b871774a
commit ca59c97510

View File

@ -42,6 +42,7 @@ public class Hero {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("This is a ");
sb.append(profession);
sb.append(" named ");
sb.append(name);
@ -62,7 +63,7 @@ public class Hero {
sb.append(armor);
}
if (weapon != null) {
sb.append(" and wielding ");
sb.append(" and wielding a ");
sb.append(weapon);
}
sb.append(".");