java.lang.ClassCastException: Animal cannot be cast to Dog

coderevisited.com | 6 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Cloneable Interface in Java, How to override Object.clone()

    coderevisited.com | 6 months ago
    java.lang.ClassCastException: Animal cannot be cast to Dog

    Root Cause Analysis

    1. java.lang.ClassCastException

      Animal cannot be cast to Dog

      at Dog.clone()
    2. Unknown
      CloneableTest.main
      1. Dog.clone(Dog.java:12)
      2. CloneableTest.main(CloneableTest.java:5)
      2 frames