Type Casting:

Assigning a value of one type to a variable of another type is known as Type Casting. In Java, type casting is classified into two types.

Widening or Automatic type conversion Automatic Type casting take place when,

  • the two types are compatible

  • the target type is larger than the source type

Output:

Int value 100

Long value 100

Float value 100.0

Last updated