O'Reilly logo

From Java to C#: A Developer's Guide by Heng Ngee Mok

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 13. Exception handling

If you are a Java developer, C#'s exception handling mechanism is very similar to Java's, and you will feel very comfortable. [1] There are, of course, new things to learn – C# has done away with checked exceptions and built in something called inner exceptions, as well as other minor improvements.

[1] VB 6 developers will find exception handling a totally new thing to pick up when they move over to VB .NET. VB 6 has no proper exception handling mechanism, and developers rely on the ancient On Error Goto construct to handle errors.

C# has four keywords for exception handling – try, catch, finally, and throw. Notice that C# does not have the throws keyword which Java developers use when declaring methods.

I shall ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required