Java Reference
In-Depth Information
{
return name + " " + value;
}
. . .
}
΢΢΢ Exercise R8.14. Ideally, a method should have no side effects. Can you
write a program in which no method has a side effect? Would such a
program be useful?
΢΢ Exercise R8.15. Write preconditions for the following methods. Do not
implement the methods.
a. public static double sqrt(double x)
b. public static String romanNumeral (int n)
c. public static double slope(Line2D.Double a)
d. public static String weekday (int day)
΢΢ Exercise R8.16. What preconditions do the following methods from the
standard Java library have?
a. Math.sqrt
b. Math.tan
c. Math.log
d. Math.exp
e. Math.pow
f. Math.abs
377
378
΢΢ Exercise R8.17. What preconditions do the following methods from the
standard Java library have?
a. Integer.parseInt(String s)
b. StringTokenizer. nextToken()
Search WWH ::




Custom Search