亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? answers to questions and exercises exceptions.htm

?? 用java 編寫的十分基礎的幾個簡單類
?? HTM
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0079)http://java.sun.com/docs/books/tutorial/essential/exceptions/QandE/answers.html -->
<HTML><HEAD><TITLE>Answers to Questions and Exercises: Exceptions</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<SCRIPT language=JavaScript><!-- hidefunction openWin(term) {  url="../../../information/glossary.html#" + term;  myWin= window.open(url, "Glossary",              "width=400,height=150,scrollbars=yes,status=no,toolbar=no,menubar=no");  myWin.focus();}//--></SCRIPT>

<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY link=#000099 bgColor=#ffffff><B><FONT size=-1>The Java</FONT><SUP><FONT 
size=-2>TM</FONT></SUP> <FONT size=-1>Tutorial</FONT></B> <BR>
<TABLE width=550 summary=layout>
  <TBODY>
  <TR>
    <TD vAlign=center align=left><A 
      href="http://java.sun.com/docs/books/tutorial/essential/exceptions/QandE/questions.html" 
      target=_top><IMG height=26 alt="Previous Page" 
      src="Answers to Questions and Exercises Exceptions.files/PreviousArrow.gif" 
      width=26 align=center border=0></A> <A 
      href="http://java.sun.com/docs/books/tutorial/essential/TOC.html#exceptions" 
      target=_top><IMG height=26 alt="Lesson Contents" 
      src="Answers to Questions and Exercises Exceptions.files/TOCIcon.gif" 
      width=26 align=center border=0></A> </TD>
    <TD vAlign=center align=middle><FONT size=-1><A 
      href="http://java.sun.com/docs/books/tutorial/index.html" 
      target=_top>Start of Tutorial</A> &gt; <A 
      href="http://java.sun.com/docs/books/tutorial/essential/index.html" 
      target=_top>Start of Trail</A> &gt; <A 
      href="http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html" 
      target=_top>Start of Lesson</A> </FONT></TD>
    <TD vAlign=center align=right><FONT size=-1><A 
      href="http://java.sun.com/docs/books/tutorial/search.html" 
      target=_top>Search</A> <BR><A 
      href="http://java.sun.com/docs/books/tutorial/forms/sendusmail.html">Feedback 
      Form</A> </FONT></TD></TR></TBODY></TABLE><IMG height=8 alt="" 
src="Answers to Questions and Exercises Exceptions.files/blueline.gif" width=550 
align=bottom NATURALSIZEFLAG="3"> <BR><FONT size=-1><B>Trail</B>: Essential Java 
Classes <BR><B>Lesson</B>: Handling Errors with Exceptions </FONT>
<H2>Answers to Questions and Exercises: Exceptions </H2>
<BLOCKQUOTE></BLOCKQUOTE>
<H3>Questions</H3>
<BLOCKQUOTE>
  <OL>
    <LI><FONT color=red>Question:</FONT> Is the following code legal? 
    <BLOCKQUOTE><PRE>try {
    ...
} finally {
    ...
}
</PRE></BLOCKQUOTE><FONT color=green>Answer:</FONT> Yes, it's legal. A 
    <CODE>try</CODE> statement does not have to have a <CODE>catch</CODE> 
    statement if it has a <CODE>finally</CODE> statement. If the code in the 
    <CODE>try</CODE> statement has multiple exit points and no associated 
    <CODE>catch</CODE> clauses, the code in the <CODE>finally</CODE> statement 
    is executed no matter how the <CODE>try</CODE> block is exited. 
    <P></P>
    <LI><FONT color=red>Question:</FONT> What exception types can be caught by 
    the following handler? 
    <BLOCKQUOTE><PRE>catch (Exception e) {
    ...
}
</PRE></BLOCKQUOTE>What is wrong with using this type of exception handler? 
    <P><FONT color=green>Answer:</FONT> This handler catches exceptions of type 
    <CODE>Exception</CODE>; therefore, it catches any exception. This can be a 
    poor implementation because you are losing valuable information about the 
    type of exception being thrown and making your code less efficient. As a 
    result, the runtime system is forced to determine the type of exception 
    before it can decide on the best recovery strategy. 
    <P></P>
    <LI><FONT color=red>Question:</FONT> What exceptions can be caught by the 
    following handler? 
    <BLOCKQUOTE><PRE>...
} catch (Exception e) {
    ...
} catch (ArithmeticException a) {
    ...
}
</PRE></BLOCKQUOTE>Is there anything wrong with this exception handler as 
    written? Will this code compile? 
    <P><FONT color=green>Answer:</FONT> This first handler catches exceptions of 
    type <CODE>Exception</CODE>; therefore, it catches any exception, including 
    <CODE>ArithmeticException</CODE>. The second handler could never be reached. 
    This code will not compile. 
    <P></P>
    <LI><FONT color=red>Question:</FONT> Match each situation in the first 
    column with an item in the second column. 
    <TABLE border=1>
      <TBODY>
      <TR>
        <TD vAlign=top>
          <OL type=a>
            <LI><CODE>int[] A; <BR>A[0] = 0;</CODE> 
            <P></P>
            <LI>The Java VM starts running your program, but the VM can抰 find 
            the Java platform classes. (The Java platform classes reside in 
            <CODE>classes.zip</CODE> or <CODE>rt.jar</CODE>.) 
            <P></P>
            <LI>A program is reading a stream and reaches the end of stream 
            marker. 
            <P></P>
            <LI>Before closing the stream and after reaching the end of stream 
            marker, a program tries to read the stream again. </LI></OL>
        <TD vAlign=top>
          <OL type=1>
            <LI>error 
            <P></P>
            <LI>checked exception 
            <P></P>
            <LI>runtime exception 
            <P></P>
            <LI>no exception </LI></OL></TR></TBODY></TABLE>
    <P><FONT color=green>Answer:</FONT> 
    <OL type=a>
      <LI>3 (runtime exception). 
      <LI>1 (error). 
      <LI>4 (no exception). When you read a stream, you expect there to be an 
      end of stream marker. You should use exceptions to catch unexpected 
      behavior in your program. 
      <LI>2 (checked exception). </LI></OL></LI></OL></BLOCKQUOTE>
<H3>Exercises</H3>
<BLOCKQUOTE>
  <OL>
    <LI><FONT color=red>Exercise:</FONT> Add a <CODE>readList</CODE> method to 
    <A 
    href="http://java.sun.com/docs/books/tutorial/essential/exceptions/example/ListOfNumbers.java" 
    target=_blank><FONT 
    color=#bb000f><CODE><CODE>ListOfNumbers.java</CODE></CODE></FONT></A><A 
    href="http://java.sun.com/docs/books/tutorial/essential/exceptions/example/ListOfNumbers.java" 
    target=_blank><IMG height=11 alt=" (in a .java source file)" 
    src="Answers to Questions and Exercises Exceptions.files/sourceIcon.gif" 
    width=11 align=absMiddle border=0></A>. This method should read in 
    <CODE>int</CODE> values from a file, print each value, and append them to 
    the end of the vector. You should catch all appropriate errors. You will 
    also need a text file containing numbers to read in. 
    <P><FONT color=green>Answer:</FONT> See <CODE><A 
    href="http://java.sun.com/docs/books/tutorial/essential/exceptions/example-1dot1/ListOfNumbers2.java" 
    target=_blank><FONT 
    color=#bb000f><CODE><CODE>ListOfNumbers2.java</CODE></CODE></FONT></A><A 
    href="http://java.sun.com/docs/books/tutorial/essential/exceptions/example-1dot1/ListOfNumbers2.java" 
    target=_blank><IMG height=11 alt=" (in a .java source file)" 
    src="Answers to Questions and Exercises Exceptions.files/sourceIcon.gif" 
    width=11 align=absMiddle border=0></A>.</CODE></P>
    <P></P>
    <LI><FONT color=red>Exercise:</FONT> Modify the following <CODE>cat</CODE> 
    method so that it will compile: 
    <BLOCKQUOTE><PRE>public static void cat(File named) {
    RandomAccessFile input = null;
    String line = null;

    try {
        input = new RandomAccessFile(named, "r");
        while ((line = input.readLine()) != null) {
            System.out.println(line);
        }
        return;
    } finally {
        if (input != null) {
            input.close();
        }
    }
}
</PRE></BLOCKQUOTE>
    <P><FONT color=green>Answer:</FONT> The code to catch exceptions is shown in 
    red: 
    <BLOCKQUOTE><PRE>public static void cat(File named) {
    RandomAccessFile input = null;
    String line = null;

    try {
        input = new RandomAccessFile(named, "r");
        while ((line = input.readLine()) != null) {
            System.out.println(line);
        }
        return;
<FONT color=red>    } catch(FileNotFoundException fnf) {
        System.err.println("File: " + named + " not found.");
    } catch(Exception e) {
        System.err.println(e.toString());</FONT>
    } finally {
        if (input != null) {
<FONT color=red>            try {</FONT>
                input.close();
<FONT color=red>            } catch(IOException io) {
            }</FONT>
        }
    }
}
</PRE></BLOCKQUOTE>
    <P></P></LI></OL>
  <OL></OL></BLOCKQUOTE>
<BLOCKQUOTE></BLOCKQUOTE><IMG height=8 alt="" 
src="Answers to Questions and Exercises Exceptions.files/blueline.gif" width=550 
align=bottom NATURALSIZEFLAG="3"> <BR>
<TABLE width=550 summary=layout>
  <TBODY>
  <TR>
    <TD vAlign=center align=left><A 
      href="http://java.sun.com/docs/books/tutorial/essential/exceptions/QandE/questions.html" 
      target=_top><IMG height=26 alt="Previous Page" 
      src="Answers to Questions and Exercises Exceptions.files/PreviousArrow.gif" 
      width=26 align=center border=0></A> <A 
      href="http://java.sun.com/docs/books/tutorial/essential/TOC.html#exceptions" 
      target=_top><IMG height=26 alt="Lesson Contents" 
      src="Answers to Questions and Exercises Exceptions.files/TOCIcon.gif" 
      width=26 align=center border=0></A> </TD>
    <TD vAlign=center align=middle><FONT size=-1><A 
      href="http://java.sun.com/docs/books/tutorial/index.html" 
      target=_top>Start of Tutorial</A> &gt; <A 
      href="http://java.sun.com/docs/books/tutorial/essential/index.html" 
      target=_top>Start of Trail</A> &gt; <A 
      href="http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html" 
      target=_top>Start of Lesson</A> </FONT></TD>
    <TD vAlign=center align=right><FONT size=-1><A 
      href="http://java.sun.com/docs/books/tutorial/search.html" 
      target=_top>Search</A> <BR><A 
      href="http://java.sun.com/docs/books/tutorial/forms/sendusmail.html">Feedback 
      Form</A> </FONT></TD></TR></TBODY></TABLE>
<P><FONT size=-1><A 
href="http://java.sun.com/docs/books/tutorial/information/copyright.html">Copyright</A> 
1995-2003 Sun Microsystems, Inc. All rights reserved. </FONT></P></BODY></HTML>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人av自拍| 中文av一区二区| 久久亚洲一级片| 亚洲综合色自拍一区| 韩国视频一区二区| 欧美性感一区二区三区| 久久午夜羞羞影院免费观看| 亚洲国产一区二区三区青草影视| 成人午夜短视频| 日韩欧美激情在线| 亚洲成在线观看| 91亚洲精品久久久蜜桃| 国产香蕉久久精品综合网| 日本中文在线一区| 91福利在线免费观看| 中文字幕精品一区二区精品绿巨人| 日韩高清中文字幕一区| 日本黄色一区二区| 17c精品麻豆一区二区免费| 国产乱人伦偷精品视频不卡| 日韩一级黄色大片| 亚洲一区二区在线视频| 成人性生交大合| 久久久久久久精| 日韩电影在线看| 欧美丝袜自拍制服另类| 亚洲视频一二三| 色哟哟国产精品| 一区二区三区日韩精品视频| 99国产精品久| 亚洲精品日韩专区silk| 在线日韩国产精品| 一区二区三区在线播放| 99久久精品一区二区| 亚洲欧美一区二区不卡| 欧美三级电影网| 性感美女久久精品| 欧美日韩黄色一区二区| 偷拍日韩校园综合在线| 欧美系列日韩一区| 亚洲777理论| 3d成人动漫网站| 老司机精品视频线观看86| 精品成人在线观看| 国产精品一区二区你懂的| 国产丝袜美腿一区二区三区| jizzjizzjizz欧美| 一区二区三区高清在线| 欧美日本一区二区| 毛片一区二区三区| 久久久久成人黄色影片| 波多野结衣中文一区| 国产精品国产三级国产| 91成人在线观看喷潮| 午夜a成v人精品| 337p粉嫩大胆噜噜噜噜噜91av | 欧美xxxxxxxxx| 国产一区二区精品久久| 国产精品蜜臀av| 欧美日韩一区视频| 精品午夜久久福利影院| 国产精品毛片大码女人| 欧美色中文字幕| 久草精品在线观看| 国产精品国产三级国产aⅴ入口 | 成人理论电影网| 一区二区三区在线高清| 精品三级av在线| 91免费看`日韩一区二区| 视频在线在亚洲| 久久综合视频网| 日本精品一级二级| 久久成人免费电影| 国产精品国产a级| 91精品国产一区二区人妖| 国产成人精品三级麻豆| 亚洲一区二区五区| 久久久美女毛片| 欧美图片一区二区三区| 国产盗摄女厕一区二区三区| 一区二区在线观看不卡| 欧美精品一区视频| 91久久久免费一区二区| 国产精品综合一区二区三区| 亚洲国产日韩在线一区模特| 欧美国产成人精品| 日本一区免费视频| 91麻豆精品国产91久久久更新时间 | 国产精品久久久一本精品| 欧美高清视频一二三区| www.成人网.com| 国产精品自产自拍| 三级在线观看一区二区| 国产精品久久久久婷婷二区次| 日韩欧美亚洲国产另类| 欧美在线观看视频在线| 成人三级伦理片| 久久精品国产99国产| 婷婷久久综合九色综合绿巨人| 中文字幕人成不卡一区| 久久久99久久| 精品成人在线观看| 欧美电影精品一区二区| 91精品国产色综合久久不卡电影| 在线观看一区二区视频| 91美女片黄在线观看91美女| 成人短视频下载| 风流少妇一区二区| 国产精品影音先锋| 精品综合免费视频观看| 美国欧美日韩国产在线播放| 日本亚洲三级在线| 日韩中文字幕不卡| 五月综合激情婷婷六月色窝| 亚洲午夜一二三区视频| 一区二区三区精密机械公司| 亚洲高清免费在线| 亚洲一区二区精品3399| 亚洲一区二区在线视频| 午夜欧美电影在线观看| 午夜精品久久久久久久蜜桃app| 亚洲国产日韩一区二区| 亚洲高清免费视频| 天天操天天干天天综合网| 青娱乐精品视频| 麻豆国产精品视频| 国产伦精品一区二区三区视频青涩 | 亚洲国产精品久久一线不卡| 亚洲高清免费在线| 午夜亚洲国产au精品一区二区| 亚洲电影在线免费观看| 日本成人在线不卡视频| 精品一区二区三区在线观看| 国产一区二区视频在线| 成人午夜私人影院| 色狠狠一区二区| 欧美精品成人一区二区三区四区| 91超碰这里只有精品国产| 日韩你懂的在线播放| 国产喂奶挤奶一区二区三区| 国产精品高清亚洲| 亚洲bdsm女犯bdsm网站| 看国产成人h片视频| 国产成人亚洲综合色影视| 欧美精品黑人性xxxx| 亚洲精品一区二区三区香蕉| 亚洲人精品午夜| 蜜桃视频在线观看一区| 丁香另类激情小说| 欧美影片第一页| 精品国产青草久久久久福利| 中文字幕亚洲精品在线观看| 视频在线观看国产精品| 国产91露脸合集magnet| 欧美三级在线看| 久久久久九九视频| 亚洲午夜久久久久久久久久久| 狠狠色狠狠色综合系列| 在线精品视频免费观看| 久久美女艺术照精彩视频福利播放| 国产精品短视频| 理论电影国产精品| 91蜜桃在线观看| 26uuu亚洲综合色欧美| 亚洲一线二线三线久久久| 豆国产96在线|亚洲| 欧美丰满美乳xxx高潮www| 亚洲国产精品二十页| 午夜精品免费在线观看| 91免费视频网| 国产日韩精品一区二区三区| 日韩高清不卡一区| 色天使色偷偷av一区二区| 久久嫩草精品久久久精品一| 亚洲大片一区二区三区| 91老师片黄在线观看| 亚洲精品在线观| 日韩成人一级大片| 99久久久无码国产精品| 日本一区免费视频| 久久国产精品色婷婷| 欧美伦理视频网站| 亚洲免费观看高清完整| 国产a区久久久| 精品久久人人做人人爰| 婷婷久久综合九色国产成人| 91麻豆免费视频| 亚洲色图都市小说| 99久久精品免费看国产免费软件| 2023国产精品| 狠狠狠色丁香婷婷综合激情 | 国产精品久久久久三级| 精品在线亚洲视频| 日韩一区二区精品| 青青青伊人色综合久久| 欧美一区二区三区性视频| 夜夜精品视频一区二区| 91猫先生在线| 亚洲综合激情另类小说区| 日本丶国产丶欧美色综合|