Type Casting in Java ( Java Part -3 )

Type Casting in Java 

Type casting is the practice of converting a data type from one type to another. In Java there are two type of type conversions. The type casting is fully similar to that of type conversion in C and C++.

1. Widening Casting : - This is used to convert from smaller range data type to larger range datatype. Generally these are done automatically.
byte -> short -> char -> int -> long -> float -> double

2 Narrowing Casting :- This is used to convert from larger data type to smaller data type. Generally this type of type conversion is done manually.
double -> float -> long -> int -> char -> short -> byte

 

Comments

Popular posts from this blog

Bubble Sort ( C & Python 3)

Something about me

Comparison Logical and Bitwise Operator ( Java Part - 4 )