There three kind of catch ... throw method:
The last two method are the same, while the first is different.
The first method will swallow down the exception's StackTrace
Example:
1
class Class1
2
}
2
the result is:
at ConsoleApplication1.Class1.throwE()
at ConsoleApplication1.Class1.fun()
at ConsoleApplication1.Class1.Main(String[] args)
if we change the fun() to :
1
void fun()
2
}
2
the result is:
at ConsoleApplication1.Class1.fun()
at ConsoleApplication1.Class1.Main(String[] args)
we lose the true throw exception trace, so avoid "throw e"