Why the casting gives ClassCastException? Thread class provides the implementation for Runnable interface. Then why cannot we cast???
posted 8 years ago
This is because r1 is an implementer of the Runnable Interface. Thread class also is an implementer of Runnable. But there is no relation between r1(anonymous sub-class referenced by r1) and the Thread class.