⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 15.10.htm

📁 This ECMA Standard specifies the form and establishes the interpretation of programs written in the
💻 HTM
📖 第 1 页 / 共 2 页
字号:
   static void Main() {  
      try {  
         F();  
      }  
      catch (Exception e) {  
         Console.WriteLine("Exception in Main: " + e.Message);  
      }  
   }  
}  
</pre>the method F catches an exception, writes some diagnostic information to the console, alters the exception variable, and re-throws the exception. The exception that is re-thrown is the original exception, so the output produced is: <pre class="code-example">
Exception in F: G  
Exception in Main: G  
</pre></span></span><span class="paragraph"><span class="example">If the first catch block had thrown e instead of rethrowing the current exception, the output produced would be as follows: <pre class="code-example">
Exception in F: G  
Exception in Main: F  
</pre>end example]</span> </span><span class="locator">
     Paragraph 10</span><span class="paragraph"><span class="sentence"><span class="sentence-number">1</span> <a name="P10S1"></a>It is a compile-time error for a break, continue, or goto statement to transfer control out of a finally block.</span> <span class="sentence"><span class="sentence-number">2</span> <a name="P10S2"></a>When a break, continue, or goto statement occurs in a finally block, the target of the statement must be within the same finally block, or otherwise a compile-time error occurs.</span> </span><span class="locator">
     Paragraph 11</span><span class="paragraph"><span class="sentence"><span class="sentence-number">1</span> <a name="P11S1"></a>It is a compile-time error for a return statement to occur in a finally block.</span> </span><span class="locator">
     Paragraph 12</span><span class="paragraph"><span class="sentence"><span class="sentence-number">1</span> <a name="P12S1"></a>A try statement is executed as follows: </span><ul><li><span class="sentence"><span class="sentence-number">2</span> <a name="P12S2"></a> Control is transferred to the try block.</span> </li><li><span class="sentence"><span class="sentence-number">3</span> <a name="P12S3"></a> When and if control reaches the end point of the try block: </span></li><ul><li><span class="sentence"><span class="sentence-number">4</span> <a name="P12S4"></a> If the try statement has a finally block, the finally block is executed.</span> </li><li><span class="sentence"><span class="sentence-number">5</span> <a name="P12S5"></a> Control is transferred to the end point of the try statement.</span> </li></ul><li><span class="sentence"><span class="sentence-number">6</span> <a name="P12S6"></a> If an exception is propagated to the try statement during execution of the try block: </span></li><ul><li><span class="sentence"><span class="sentence-number">7</span> <a name="P12S7"></a> The catch clauses, if any, are examined in order of appearance to locate a suitable handler for the exception.</span> <span class="sentence"><span class="sentence-number">8</span> <a name="P12S8"></a>The first catch clause that specifies the exception type or a base type of the exception type is considered a match.</span> <span class="sentence"><span class="sentence-number">9</span> <a name="P12S9"></a>A general catch clause is considered a match for any exception type.</span> <span class="sentence"><span class="sentence-number">10</span> <a name="P12S10"></a>If a matching catch clause is located: </span></li><ul><li><span class="sentence"><span class="sentence-number">11</span> <a name="P12S11"></a> If the matching catch clause declares an exception variable, the exception object is assigned to the exception variable.</span> </li><li><span class="sentence"><span class="sentence-number">12</span> <a name="P12S12"></a> Control is transferred to the matching catch block.</span> </li><li><span class="sentence"><span class="sentence-number">13</span> <a name="P12S13"></a> When and if control reaches the end point of the catch block: </span></li><ul><li><span class="sentence"><span class="sentence-number">14</span> <a name="P12S14"></a> If the try statement has a finally block, the finally block is executed.</span> </li><li><span class="sentence"><span class="sentence-number">15</span> <a name="P12S15"></a> Control is transferred to the end point of the try statement.</span> </li></ul><li><span class="sentence"><span class="sentence-number">16</span> <a name="P12S16"></a> If an exception is propagated to the try statement during execution of the catch block: </span></li><ul><li><span class="sentence"><span class="sentence-number">17</span> <a name="P12S17"></a> If the try statement has a finally block, the finally block is executed.</span> </li><li><span class="sentence"><span class="sentence-number">18</span> <a name="P12S18"></a> The exception is propagated to the next enclosing try statement.</span> </li></ul></ul><li><span class="sentence"><span class="sentence-number">19</span> <a name="P12S19"></a> If the try statement has no catch clauses or if no catch clause matches the exception: </span></li><ul><li><span class="sentence"><span class="sentence-number">20</span> <a name="P12S20"></a> If the try statement has a finally block, the finally block is executed.</span> </li><li><span class="sentence"><span class="sentence-number">21</span> <a name="P12S21"></a> The exception is propagated to the next enclosing try statement.</span> </li></ul></ul></ul></span><span class="locator">
     Paragraph 13</span><span class="paragraph"><span class="sentence"><span class="sentence-number">1</span> <a name="P13S1"></a>The statements of a finally block are always executed when control leaves a try statement.</span> <span class="sentence"><span class="sentence-number">2</span> <a name="P13S2"></a>This is true whether the control transfer occurs as a result of normal execution, as a result of executing a break, continue, goto, or return statement, or as a result of propagating an exception out of the try statement.</span> </span><span class="locator">
     Paragraph 14</span><span class="paragraph"><span class="sentence"><span class="sentence-number">1</span> <a name="P14S1"></a>If an exception is thrown during execution of a finally block, the exception is propagated to the next enclosing try statement.</span> <span class="sentence"><span class="sentence-number">2</span> <a name="P14S2"></a>If another exception was in the process of being propagated, that exception is lost.</span> <span class="sentence"><span class="sentence-number">3</span> <a name="P14S3"></a>The process of propagating an exception is discussed further in the description of the throw statement (<a href="15.9.5.htm">&#167;15.9.5</a>).</span> </span><span class="locator">
     Paragraph 15</span><span class="paragraph"><span class="sentence"><span class="sentence-number">1</span> <a name="P15S1"></a>The try block of a try statement is reachable if the try statement is reachable.</span> </span><span class="locator">
     Paragraph 16</span><span class="paragraph"><span class="sentence"><span class="sentence-number">1</span> <a name="P16S1"></a>A catch block of a try statement is reachable if the try statement is reachable.</span> </span><span class="locator">
     Paragraph 17</span><span class="paragraph"><span class="sentence"><span class="sentence-number">1</span> <a name="P17S1"></a>The finally block of a try statement is reachable if the try statement is reachable.</span> </span><span class="locator">
     Paragraph 18</span><span class="paragraph"><span class="sentence"><span class="sentence-number">1</span> <a name="P18S1"></a>The end point of a try statement is reachable if both of the following are true: </span><ul><li><span class="sentence"><span class="sentence-number">2</span> <a name="P18S2"></a> The end point of the try block is reachable or the end point of at least one catch block is reachable.</span> </li><li><span class="sentence"><span class="sentence-number">3</span> <a name="P18S3"></a> If a finally block is present, the end point of the finally block is reachable.</span> </li></ul></span><span class="ruler"></span><table><tr><td><table align="left" bgcolor="navy"><tr bgcolor="navy"><td><font face="Arial,sans-serif" size="6" color="yellow"><strong>{ JSL }</strong></font></td></tr></table></td></tr><tr><td><font face="Arial,sans-serif" size="2" color="navy"><strong>Jagger Software Ltd</strong></font></td></tr><tr><td><font face="Arial,sans-serif" size="2" color="navy"><strong>Company # 4070126</strong></font></td></tr><tr><td><font face="Arial,sans-serif" size="2" color="navy"><strong>VAT # 762 5213 42</strong></font></td></tr></table><img src="valid-html401.png" align="left" height="31" width="88" alt="Valid HTML 4.01" /><img src="vcss.gif" align="left" height="31" width="88" alt="Valid CSS" /></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -