Java Reference
In-Depth Information
java.util.logging.Level
ALL
INFO
NONE
java.util.logging.Logger
getLogger
info
setLevel
java. util.Scanner
hasNextDouble
hasNextInt
REVIEW EXERCISES
΢΢ Exercise R5.1. Find the errors in the following if statements.
a. if quarters > 0 then
System.out.println(quarters + " quarters");
b. if (1 + x > Math.pow(x, Math.sqrt(2)) y = y +
x;
c. if (x = 1) y ++; else if (x = 2) y = y + 2;
d. if (x && y == 0) { x = 1; y = 1; }
e. if (1 <= x <= 10)
System.out.println(x);
f. if (! s.equals("nickels") || !
s.equals("pennies")
|| !s.equals("dimes") ||
!s.equals("quarters"))
System.out.print("Input error!");
g. if (input.equalsIgnoreCase("N") || "NO")
return;
h. int x = Integer.parseInt(input);
if (x ! = null) y = y + x;
Search WWH ::




Custom Search