Reverse-indenting exception handling blocks.

Lab Notes
Clarifying exception handling
by Matt Brenner
Listing 5. Reverse-indenting exception handling blocks.


1 public static final double
2 todouble (String text)
3 {
4      double       val;
5
6
7           try {
8      val = Double.valueOf (text).doubleValue();
9           }
10         catch (NumberFormatException e) {
11             val = Double.NaN;
12         }
13
14    return (val);
15 }