From 141f05d1798a03bfac8af648e9c6d80741c56bb0 Mon Sep 17 00:00:00 2001 From: Cristian Stancalau Date: Mon, 9 Nov 2020 19:16:59 +0200 Subject: [PATCH] Rename Reptile to Amphibian --- .../classcastexception/{Reptile.java => Amphibian.java} | 2 +- .../java/com/baeldung/exceptions/classcastexception/Frog.java | 2 +- .../exceptions/classcastexception/CheckedCastsUnitTest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/{Reptile.java => Amphibian.java} (75%) diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Reptile.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Amphibian.java similarity index 75% rename from core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Reptile.java rename to core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Amphibian.java index ed4b0273e5..cb15977cf8 100644 --- a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Reptile.java +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Amphibian.java @@ -1,6 +1,6 @@ package com.baeldung.exceptions.classcastexception; -public class Reptile implements Animal { +public class Amphibian implements Animal { @Override public String getName() { diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Frog.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Frog.java index 0a0b2d1f63..a3837f4c2f 100644 --- a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Frog.java +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Frog.java @@ -1,6 +1,6 @@ package com.baeldung.exceptions.classcastexception; -public class Frog extends Reptile { +public class Frog extends Amphibian { @Override public String getName() { diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/CheckedCastsUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/CheckedCastsUnitTest.java index 7fac000fa8..8e62a10e2f 100644 --- a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/CheckedCastsUnitTest.java +++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/CheckedCastsUnitTest.java @@ -11,7 +11,7 @@ public class CheckedCastsUnitTest { Animal animal = new Frog(); //A checked downcast to Mammal is incompatible from Frog because Frog is not a subtype of Mammal. - Mammal mammal = (Mammal) animal; + Mammal mammal1 = (Mammal) animal; } @Test(expected = ClassCastException.class)