Possible Duplicate:
Why the result of 1/3=0 in java?
I'm working with java, and part of my code requires a number to be divided by 10. To simplify (and show my question) I just put it into a println:
System.out.println(1/10);
that prints out 0. So, logically, I figured it was casting it to an int, so I tried
System.out.println((double)1/10);
and that printed out the proper 0.1. I don't understand why it automatically cast it into an int the first time though. Where else does it do this? Why?