Object o = "hello";
Integer i = (Integer) o;What happens?
- A
i is 0
- B
Compile-time error
- Ccheck_circle
ClassCastException at runtime
- D
i is null
Explanation
Cast compiles (Object can be Integer in principle) but the actual object is a String, so a ClassCastException is thrown at runtime.