📄 tsld046.htm
字号:
<HTML>
<HEAD>
<META HTTP-EQUIV="Context-Type" CONTEXT="text/html;charset=windows-1252">
<meta name="GENERATOR" content="Microsoft Internet Assistant for PowerPoint 97">
<TITLE>Exception Handling Example</TITLE>
</HEAD>
<BODY >
<H1>Exception Handling Example</H1>
<P><UL>
public class ExceptionExample {
<BR></UL><UL>
public static void main (String[] argv) {
</UL><UL>
int [] numArray; // declaration
</UL><UL>
numArray = new int[10]; // creation
</UL><UL>
try {
</UL><UL>
for (int x=0; x<numArray.length +1; x++) {
</UL><UL>
numArray[x] = x * 2;
</UL><UL>
System.out.print(numArray[x] + ":");
</UL><UL>
}
</UL><UL>
}
</UL><UL>
catch (ArrayIndexOutOfBoundsException ex) {
</UL><UL>
System.out.println("Array Exception caught!!");
</UL><UL>
}
</UL><UL>
finally {
</UL><UL>
System.out.println("Reached finally clause");
</UL><UL>
}
</UL><UL>
}
</UL><UL>
}</UL></P>
<P><UL>
Causes the
<BR></UL><UL>
Exception</UL></P>
<P></P>
<P>
<TABLE>
<TD HEIGHT=100 WIDTH=100> <A HREF="tsld045.htm">Previous slide</A> </TD>
<TD HEIGHT=100 WIDTH=100> <A HREF="tsld047.htm">Next slide</A> </TD>
<TD HEIGHT=100 WIDTH=150> <A HREF="tsld001.htm">Back to first slide</A> </TD>
<TD HEIGHT=100 WIDTH=150> <A HREF="sld046.htm">View graphic version</A> </TD>
</TABLE>
<BR>
</P>
</Body>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -