Cast Operator converts numeric values from one type to another or to change an object reference type. : Cast Operators « Operators « SCJP






public class MainClass{
    public static void main(String[] argv){
        int i = 277;
        byte b = (byte)i;
        System.out.println(b);
    }
}
21








2.4.Cast Operators
2.4.1.The Cast Operator (type) is for explicit conversion of a type.
2.4.2.Cast Operator converts numeric values from one type to another or to change an object reference type.
2.4.3.Compiler does not object to add an int value to a byte because it performs an explicit cast