TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Error Handling Using Try, Catch And Finally Blocks In C#
Vijayaragavan S
Aug 24
2016
Code
4.4
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
using
System;
class
Program {
static
void
Main(
string
[] args) {
int
[] a =
new
int
[3];
int
n = args.Length;
try
{
if
(n == 0) {
int
d = 10 / (n);
}
if
(n == 1) {
a[4] = 6;
}
}
catch
(IndexOutOfRangeException e) {
Console.WriteLine(
"Exception"
+ e);
}
catch
(DivideByZeroException e) {
Console.WriteLine(
"DivideByZeroException"
+ e);
}
finally
{
Console.WriteLine(
"finally block :: End of Program"
);
}
Console.ReadKey();
}
}
Error Handling
Try
Catch
Finally Blocks
C#