0
why is typecasting done in java?
2 Answers
+ 1
Assigning a value of one type to a variable of another type is known as Type Casting.
If I ask for the user a input for a item quantity and I get it as an integer:
int qtt = 2;
Imagine I want get this quantity as a float 2.00, so I need to Type Cast this int into float:
float newQtt = (float)qtt;
0
thank you Felipe