i have an integer and i cant understand why i can assign its value to a float without casting ?
Top of my head:
int takes up less space in memory than float. I believe that Head First Java explained this beautifully when they mentioned cup size. int is a smaller cup than float, hence you can pour the contents of a small cup into a big cup without fear of it spilling over.
funny thing is, both int and long both fit into a float, despite long being a 64 bit integer. Ie: it can still be converted into a float without casting, even though a float is 32 bits.... go figure, but I believe the explanation is that "floats are weird" :P