This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: the result of 7.5 % 3 is a double 36. ArithmeticException division by 0 (run time error) 37. there should not be a space between and = 38. no error. A constant decimal value between 0 and 65535 can be assigned to a char. 39. yes; cannot assign an int value to a boolean variable. 2.7.5 Debugging Area Using Messages from the Java Compiler and the Java JVM 40 - cannot assign a double to an int variable (possible loss of precision). Change to: double a = 26.4; 41. Missing semicolon at the end of the statement. Change to int a = 3; 42. we are performing integer division, then typecasting to a double. That is why the result is 3.0 and not 3.2. In order to obtain 3.2, change the third statement to double c = ( double ) a / b; 43. =+ is different from += (shortcut operator). Here, a is assigned the value + 3. To add 3 to a, change the second statement to: a += 3; AF_CH02 Page 2...
View Full Document
- Summer '09
- Java Programming