-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain_83.java
More file actions
30 lines (30 loc) · 858 Bytes
/
Main_83.java
File metadata and controls
30 lines (30 loc) · 858 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
import java.util.Scanner;
class MyExcep extends Exception{
public String toString(){
return super.toString()+"this is toString()";
}
public String getMessage(){
return super.getMessage()+" This is getMessage()";
}
}
public class Main_83 {
public static void main(String[] args) {
int a;
Scanner in=new Scanner(System.in);
System.out.println("Enter a number:");
a=in.nextInt();
if (a<99){
try {
throw new MyExcep();
}
catch (Exception e){
System.out.println(e.getMessage());
System.out.println(e.toString());
System.out.println(e);
e.printStackTrace();
}
System.out.println("end");
}
System.out.println("program end");
}
}