Non Primitive Type Casting In Java