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
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Tommy Sin
NA
19
104.3k
Why doesnt StackOverflowException get caught here?
Mar 14 2011 3:08 PM
I am wondering why the StackOverflowException is not caught while running the following program.
The program is just terminated due to StackOverflowException, why doesnt it catch the exception before it terminates?
Could anyone please explain? Thanks.
class program
{
private static int val = 0;
static void Main(string[] args)
{
Recursive();
}
static void Recursive()
{
try
{
Console.WriteLine(val);
val++;
Recursive();
}
catch(StackOverflowException e)
{
Console.WriteLine(e.Message);
return;
}
}
}
Reply
Answers (
1
)
Need help to create a web site
I am wondering why it catches StackOverflowException