-
March 6th, 2004, 01:55 AM
#1
Java Question
One of the rules when working with java is :
( *, /, % ) takes precendence over ( + , - )
So how comes the result produces 2.5, and not 3 (to get 3 i did three/two first = 1.5 and then added 1.5 to it - this follows the above rule
------------------------
int three = 3;
int two = 2;
double result;
result = 1.5 + three/two;
result = 2.5
-------------------------
Am i over looking, or doing something really stupid ? Any ideas ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|