Sau*_*oid 1 java exception-handling try-catch-finally
我有以下代码,我喜欢使用最终获得异常消息,因为通过使用catch我可以很容易地通过它的arg.but我知道我无法使用finally获取异常消息.
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
}
Run Code Online (Sandbox Code Playgroud)