Java Reference
In-Depth Information
SR15. /** = s with the first, third, fifth, ..., chars removed */
public static int removeE(String s)
Answers to self-review exercises
SR1. An ancestor is either a parent or an ancestor of a parent.
SR2. An integer is either a digit (one of 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , and 9 ) or an inte-
ger followed by a digit.
We present only the bodies of the methods.
SR3. if (h > n) { return ; }
b[h]= h;
setToI(b, h + 1, n);
SR4. if (h > n) { return ; }
System.out.println(h * h);
printSquares(h + 1, n);
SR5. if (h > k) {
System.out.println(n);
return ;
}
if (h != 0 && n % h == 0)
{ return ; }
// { n is not divisible by h }
printIfNot(n, h + 1, k);
SR6. if (h >= b.length) { return ; }
if (x == b[h]) {
System.out.println(x);
return ;
}
printX(b, x, h + 1);
SR7. if (h > k) { return ; }
if (h != 0 && n % h == 0) {
System.out.println(n);
return ;
}
printIf(n, h + 1, k);
SR8. if (n < 0) { return ; }
System.out.println(n * n);
printSquares(n - 1);
SR9. if (h >= b.length) { return ; }
if (h % 2 == 0)
 
Search WWH ::




Custom Search