我有下面的代碼,我喜歡用finally語句來獲取異常消息,通過使用catch語句我可以很容易地獲得它的arg.but儘可能多的我知道我無法獲得使用finally的異常消息。使用finally語句在java中捕獲異常並使用它的消息
try {
MyClass obj=new MyClass();
obj.strProName = jobj1.getString("productname");
obj.strPrice = jobj1.getString("price");
obj.strCurrency = jobj1.getString("currency");
obj.strSalePrice = jobj1.getString("saleprice");
obj.strStoreName = jobj1.getString("storename");
//arrayList.add(obj);
throw new Exception("Exception Reason!");
}
finally{
//want to get that exception message here without using catch or can see how finally catching here the exception
}
@sureshatta你一條線是值得我3行:)給予好評,從我 –
我知道這一點,但現在還我的問題仍然沒有答案。因爲我想知道只有這個東西如何通過finally.as解決新的異常(「消息」),他們必須是任何一個字符串參數方法需要被調用,但catch不存在,但捕獲是..你可以建議這件事 –