diff --git a/core-java/src/main/java/com/baeldung/javadoc/SuperHero.java b/core-java/src/main/java/com/baeldung/javadoc/SuperHero.java index 029a779cdb81..561430f66fd2 100644 --- a/core-java/src/main/java/com/baeldung/javadoc/SuperHero.java +++ b/core-java/src/main/java/com/baeldung/javadoc/SuperHero.java @@ -23,9 +23,15 @@ public class SuperHero extends Person { * @return the amount of health hero has after attack * @see HERO-402 * @since 1.0 + * @deprecated As of version 1.1, use . . . instead + * @version 1.2 + * @throws IllegalArgumentException if incomingDamage is negative */ - public int successfullyAttacked(int incomingDamage, String damageType) { + public int successfullyAttacked(int incomingDamage, String damageType) throws Exception { // do things + if (incomingDamage < 0) { + throw new IllegalArgumentException ("Cannot cause negative damage"); + } return 0; }