What is difference b/w type conversion and type casting explain with code
Type casting:-
1.In type casting, a data type is converted into another data type by a programmer using casting operator.
2.Type casting can be applied to compatible data types as well as incompatible data types.
Ex-
float x;
byte y;
....
y=(byte)x;
Type conversion:-
1.Type conversion can only be applied to compatible datatypes.
2.Type conversion is also called widening conversion because in this, the destination data type can not be smaller than the source data type.
Ex-
int x=30;
float y;
y=x; // y==30.000000.
Comments
Leave a comment