-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUdexcp.java
More file actions
42 lines (36 loc) · 773 Bytes
/
Udexcp.java
File metadata and controls
42 lines (36 loc) · 773 Bytes
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
38
39
40
41
class Udexcp
{
public static void main(String[] args) {
try{
show();
}
catch(MyException me)
{
System.out.println(me.getMessage());
}
try{
display();
}
catch(MyException me){
System.out.println(me.getMessage());
}
}
public static void show() throws MyException {
System.out.println("I am in show");
throw new MyException();
}
public static void display() throws MyException
{
System.out.println("I am in display");
throw new MyException("Hello");
}
}
class MyException extends Exception{
MyException()
{
}
MyException(String str)
{
super(str);
}
}