Why does 10/3 give 3 and not 3.333333333?
Solution. Since both 10 and 3 are integer literals, Java sees no need for type conversion and uses integer division. You should write 10.0/3.0 if you mean the numbers to be double literals. If you write 10/3.0 or 10.0/3, Java does implicit conversion to get the same result.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here