No, sqrt(8) != 4. sqrt(8) ~= 2.8284
You can verify this easily because 4*4 = 16, and likewise 2.8284*2.8284 ~= 8
Type: Posts; User: helloworld922
No, sqrt(8) != 4. sqrt(8) ~= 2.8284
You can verify this easily because 4*4 = 16, and likewise 2.8284*2.8284 ~= 8
Yes, those are integer literals and Java will use integer math. 1/2 = 0 in integer land.
Are you sure your hand-calculated answer is correct?
Try graphing your triangle and see if you can...