java.lang.ClassCastException: Hi.Dog1 cannot be cast to Hi.Cat5

Coderanch | archu sweet | 6 years 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

    Doubt regarding downcasting and upcasting

    Coderanch | 6 years ago | archu sweet
    java.lang.ClassCastException: Hi.Dog1 cannot be cast to Hi.Cat5

    Root Cause Analysis

    1. java.lang.ClassCastException

      Hi.Dog1 cannot be cast to Hi.Cat5

      at Hi.Cat5.main()
    2. Hi
      Cat5.main
      1. Hi.Cat5.main(Cat5.java:8)
      1 frame