C# FAQ: What are the differences between CSharp and Java exceptions
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
| CSharp-Online.NET:FAQs |
| edit |
[edit]
What are the differences between C# and Java exceptions?
C# and Java exceptions have many similarities. In both languages:
- exceptions are derived from the
Exceptionclass, -
tryblock to delineate guarded regions, -
catchblock to handle exceptions, -
finallyblock to facilitate releasing resources, - exceptions can be caught and rethrown after some error handling,
- exceptions can be wrapped inside each other when the caught exception differs from the rethrown one.
- exceptions are derived from the
Despite the fact that exceptions in both languages support methods for creating a stack trace, only Java exceptions can alter a stack trace.
[edit]