Java Reference
In-Depth Information
Understanding Error Messages
Figure 9-45a displays a portion of a Java program. Figure 9-45b displays the
compilation error messages. Using what you know about error messages, list the
coding error that caused TextPad to display these errors.
1
2 public class ErrorMsg
3 {
4
5
private final int minSize;
6
private boolean found = true ;
7
8
private ArrayList objList;
9
10
11
public ErrorMsg ()
12
{
13
minSize = 12;
14
objList = new ArrayList ( minSize ) ;
15
}
16
17
public ErrorMsg ( int newMinSize ) throws Exception
18
{
19
minSize = newMinSize;
20
objList = new ArrayList ( minSize ) ;
21
}
22
23
24
25 }
FIGURE 9-45a
FIGURE 9-45b
Using the Java API
The Java API is a good tool to look up information about a class with which
you may be unfamiliar or to check the syntax of commands and methods you
wish to use in your programs. While connected to the Internet, start a browser,
type http://java.sun.com/j2se/1.5/docs/api/ in the Address text box,
and then press the ENTER key to view the Java API Specification on the Sun Web
Search WWH ::




Custom Search