Java Type Casting
The Primitive datatypes in Java are the following: byte, short, int, long, float, double, boolean, and char. Type Casting is to convert one data type to another. There are two types of Type Casting in Java:
- Automatic Type Casting
- Manual Type Casting
Automatic/ Widening Type Casting in Java
The Widening type casting is handled by Java on its own i.e., it occurs when you want to convert a smaller type to a larger type.
The flow for Widening type casting in Java includes:
Let us see an example of the Automatic/ Widening Type Casting in Java:
Output
0 comments:
Post a Comment