Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
21 lines (21 loc) · 826 Bytes

File metadata and controls

21 lines (21 loc) · 826 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class finallysystemexit
{
public static void main(String[] args) {
System.out.println("When ever we are using System.exit(0) then JVM itself will be shutdown.\ncase 1. if exception occur in try block then , in this case finally block will be executed.\ncase 2. if exception not occur then finally block won't execute");
try
{
//here finally block won't be executed
System.out.println("try");
int a=10/0;//this line cause exception if we comment this line then finally block don't executed
System.exit(0);
}
catch(ArithmeticException e)
{
System.out.println("catch block executed");
}
finally
{
System.out.println("finally block executed");
}
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.