在C#中,我可以使用该throw;语句在保留堆栈跟踪的同时重新抛出异常:
try
{
...
}
catch (Exception e)
{
if (e is FooException)
throw;
}
Run Code Online (Sandbox Code Playgroud)
在Java中有这样的东西(不会丢失原始堆栈跟踪)吗?
是否可以在同一个catch块中捕获多个异常?
try
{ }
catch(XamlException s | ArgumentException a)
{ }
Run Code Online (Sandbox Code Playgroud)