Java: Output 10%3...
Posted on 2007-10-19
I have 2 questions like this:
System.out.println(10.0/3.0+5.0*2.0) where the answer is 13.33333......4
My question is how long would 33333333 be and why? coz i printed out and it was pretty long without truncating..
My second question is that :
System.out.println(10%3+5%2) where the answer printed was 2.0
I thought it should be 2 instead of 2.0 as both are integers and there is no floats or doubles that allowed it to be promoted.
Pls clarify. thanks