While programming, sometimes there is situation encounter, where we have to store a value of one type into a variable of another type. In such situations, we have to cast the value to be stores by processing it. The syntax is:

 type variable 1 = (type) variable2;

The process of converting one data type to another is called casting.

Casting is often necessary when a method returns a type different than the one we require.