Originally posted by Srinivasa Raghavan:
Yep i agree this
If either operand is of type double, the other is converted to double.
But it should be negative right or am i going wrong any where ?
I mean -2.0 == -2
[ May 10, 2005: Message edited by: Srinivasa Raghavan ]
Originally posted by Srinivasa Raghavan:
It should be -2.0 == -2.0
If either operand is of type double, the other is converted to double.
Originally posted by amit taneja:
hi in chapter 6...
in one question...
Given the following,
1. public class Example {
2. public static void main(String [] args) {
3. double values[] = {-2.3, -1.0, 0.25, 4};
4. int cnt = 0;
5. for (int x=0; x < values.length; x++) {
6. if (Math.round(values[x] + .5) == Math.ceil(values[x])) {
7. ++cnt;
8. }
9. }
10. System.out.println("same results " + cnt + " time(s)");
11. }
12. }
what is the result?
A. same results 0 time(s)
B. same results 2 time(s)
C. same results 4 time(s)
D. Compilation fails.
E. An exception is thrown at runtime.
its anser is "B"
but don't understand why... i am not able to understand its explaination...
kindly clear the doubt...
thanx
Originally posted by Billy Tsai:
I suppose there just aren't enough J2ME jobs like J2EE has
[ March 23, 2005: Message edited by: Billy Tsai ]