if int &float have the same numbers of bytes then y do v need to do casting between them
posted 14 years ago
Because Java is a "strongly typed language". Basically that means that when you declare a variable in Java you must name the type of thing that can go in it. And that is the ONLY thing that can go in it. Some languages allow sort of generic variables that can hold an assortment of stuff - but not java. Therefore if you want to put something that is a different "type" into your variable you must "promise" the JVM that it will fit by casting.
"JavaRanch, where the deer and the Certified play" - David O'Meara