0
Why do you need casting and where it uses?
I'd like to know why you need casting in explicit.
2 Answers
+ 4
Casting is used when you need some data type to converted into another data type , suppose you have a string that contains number , (String Text="123456") and you want to store the numbers (for some calculations purpose or whatever) into a integer data type (int number = Text). this is where you need casting .. because , integer data type and String(which is an abstract data type) are not compatible normally (for obvious reason) ..so you need to cast it explicitly (int number=Integer.pasreInt(Text);
+ 3
Because computer can not recognize string,float,int,or else, if we don't define the type, it will confuse the computer, so we have "casting" to make the data specific. Is it correct?