-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtry_catch_final.java
More file actions
37 lines (35 loc) · 1.02 KB
/
try_catch_final.java
File metadata and controls
37 lines (35 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import java.util.Scanner;
public class try_catch_final {
void func1()
{
try
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter value");
String var1=sc.next();
System.out.println("String value : ");
System.out.print(var1);
System.out.println("\n\n.....................\n\n");
int x = Integer.parseInt(var1);
System.out.println("Numerical value :");
System.out.println(x+ "...................try block");
sc.close();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
finally
{
System.out.println("I am fine ji ....finaly block ");
}
}
void func2(){
System.out.println("I am working ji ....");
}
public static void main(String[] args) {
try_catch_final obj = new try_catch_final();
obj.func1();
obj.func2();
}
}