As per my understanding, casts are used to convert a value from one type to another.
I found the following program in the book "Java Puzzlers: Traps, Pitfalls, and Corner Cases" by Joshua Bloch and Neal Gafter
This program uses three casts in succession:
public class Multicast { public static void main(String[] args) { System.out.println((int) (char) (byte) -1); } }
I thought it will print -1 but it is printing It prints 65535, but why?