-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPractical_30.java
More file actions
32 lines (28 loc) · 925 Bytes
/
Practical_30.java
File metadata and controls
32 lines (28 loc) · 925 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
/* Question := Write a program to generate customized exception named ArgumentGreaterThanOne if there is
more than one argument in command line. */
import java.lang.Exception;
class ArgumentGreaterThanOne extends Exception {
ArgumentGreaterThanOne(String e){
super(e);
}
}
public class Practical_30 {
public static void main(String[] args) throws ArgumentGreaterThanOne {
try{
if(args.length > 1) {
throw new ArgumentGreaterThanOne("More Than One Command Line Input Not Allowed.");
}
else {
System.out.println("Program is running Successfully.");
}
}
catch(ArgumentGreaterThanOne e)
{
System.out.println(e);
}
}
}
/* Output :=
Program is running Successfully.
*/
//Practical-30 And Practical-32 Are Same...