Rename Reptile to Amphibian

This commit is contained in:
Cristian Stancalau 2020-11-09 19:16:59 +02:00
parent af0db9610e
commit 141f05d179
3 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
package com.baeldung.exceptions.classcastexception;
public class Reptile implements Animal {
public class Amphibian implements Animal {
@Override
public String getName() {

View File

@ -1,6 +1,6 @@
package com.baeldung.exceptions.classcastexception;
public class Frog extends Reptile {
public class Frog extends Amphibian {
@Override
public String getName() {

View File

@ -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)