Q:

What kind of Exception occurred?

I tried to create a test ClassCastException:
In line 1: it prints out class cast exception as I expected
 In line 2: it just prints exception.RuntimeExceptionTest$1B@7852e922 (RuntimeExceptionTest is my class name). I wonder what kind of exception here? 
 try {
            class A { }
            class B extends A {}
            class C extends A {}
            A objA = new B();
            System.out.println((C)objA); // Line 1
            System.out.println((A)objA); // Line 2
        } catch (Exception e) {
            e.printStackTrace();
        }

A:

Line2 doesn't throw an exception. From the Oracle javadocs:

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())

That means your Line2 just prints what objA.toString() returns, which is
 exception.RuntimeExceptionTest$1B@7852e922

since exception.RuntimeExceptionTest is your class name.

