finally

    14熱度

    7回答

    public class Test2 { public static void main(String[] args) { Test2 obj=new Test2(); String a=obj.go(); System.out.print(a); } public String go() { String q=

    2熱度

    1回答

    當我把SecondMain()裏面的嘗試blcok secondMain()內的最後一塊正在執行。但是當我把它放在外面的時候它並沒有執行。爲什麼它不執行? static void Main(string[] args) { try { SecondMain(args); //try putting Console.WriteLine(

    0熱度

    2回答

    我有一個foreach循環有嘗試漁獲物和最後。它通過文件夾中的文件,並最終刪除它們....但現在,如果我有兩個文件,因爲它刪除所有(我需要刪除所有因爲應用程序功能)它不會去通過第二個文件。有沒有可能讓那麼foreach循環完成刪除這裏的foreach方法的所有文件就是一個例子: foreach (DirectoryInfo directory in directories) { for

    0熱度

    1回答

    我的大部分代碼似乎都能正常工作,但我一直在線程中得到異常「main」java.sql.SQLException:Parameter index out of range(1> number of參數,它是0)。它發生在readDatabase()中的finally塊之後。它沒有得到打印語句System.out.println(「不會在這裏」); 我不知道爲什麼。這裏是處理所有事情的課程。在主類中,

    0熱度

    6回答

    我有這樣 String str = null; try{ ... str = "condition2"; }catch (ApplicationException ae) { str = "condition3"; }catch (IllegalStateException ise) { str = "condition3"; }catch (Ex

    0熱度

    4回答

    在一些代碼,我經常與工作(和已經寫了幾十倍),如下面的代碼已經被使用: using (StreamWriter sw = new FileWriter(".\SomeFile.txt")) { // Perform file IO here... } finally { sw.Close(); } 我熟悉的try/catch /終於在C#...我知道這種情況終於有

    0熱度

    1回答

    Maby這對你很簡單,但對我來說不是。 我有這樣的代碼: Private int InsertData() { int rezultat = 0; try { if (sqlconn.State != ConnectionState.Open) { sqlconn.Open(); } rez

    4熱度

    1回答

    嗯,我讀過(並瞭解到)finally塊並不總是執行它的代碼(即使除了拔出插頭)。 FYI欲瞭解更多信息,請參閱try catch finally question 不過,我還沒有發現: 請問我finally塊得到執行時,我停止調試器? 謝謝!

    2熱度

    1回答

    假設,(使用龍捲風)一個想要傳輸大數據到慢客戶端,並打印傳輸的數據量。我寫了這個簡單的代碼用於此目的: from tornado import web, ioloop, gen class MainHandler(web.RequestHandler): @web.asynchronous @gen.engine def get(self): prin

    0熱度

    1回答

    我創建了一個VS2010 Windows服務項目。在它中,我調用Microsoft.SqlServer.Management.Smo.Database.ExecuteWithResults(表達式)方法。在我的情況下,該表達式包含無效的SQL,因此調用失敗並出現異常。 不期望什麼是是,該方法是一個try/finally塊中調用,但絕不會在執行finally塊: try { database.Exe