It is the line number in the program where the exception occured. That is the number of this line:
value[slot] = data;
Please keep in mind that Java bytecodes are executing, not the Java source code. However the bytecode file contains information about how lines of source code and bytecodes correspond. Line numbers are not given for bytecodes from the Java libraries.
Some exception types are checked exceptions, which means that a method must do something about them. The compiler checks to make sure that methods deal with these exceptions. There are two things a method can do with a checked exception:
catch{}
block, orthrow
the exception to the caller of the method.
For example, an IOException
is a checked exception.
Some programs use the readLine()
method of BufferedReader
for input.
This method throws an IOException
when there is a problem reading.
Programs that use BufferedReader
for input might to this.
public class DoesIO
{
public static void main ( String[] a ) throws IOException
{
BufferedReader stdin =
new BufferedReader ( new InputStreamReader( System.in ) );
String inData;
inData = stdin.readLine();
// More Java statements ...
}
}
The reserved word throws says that this method
does not catch the IOException
,
and that if one occurs in this method it will be thrown to the
method that called this one.
(In this example, it will be thrown back to the Java runtime system.)
(Thought question: ) What happens to the exception when it is thrown to the Java runtime system?