if(objectName instanceof Mammal currentMammal){
currentMammal.shedHair();
if the (objectName instanceof Mammal) is true then currentMammal is casted to Mammal. I see this works, but dont know how. I have never seen this stuff going on in "if" statements
I believe this makes sense.
if (ao instanceof Mammal) {
Mammal currentMammal = (Mammal) ao;
currentMammal.shedHair();
}
but this first snippet is over my head