- Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathExceptionTest.java
38 lines (37 loc) · 1.09 KB
/
ExceptionTest.java
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
/*
* This program was written by Kyle Martin on 7/17/2021 for Java Programming Principles 2 during Summer Session 2
* at Southwestern College, Kansas.
*
* IMPORTANT: Normally I would not place a bunch of comments in my code describing what my code is doing as I like to
* have code that is written in a manner to be understandable while reading it. Though, do to the grading rubric I will
* explain my code.
*
* This program was created to answer the question "what will this sudo code output when ran?"
* See Chapter 11 Algorithm Workbench Question 1.
*/
publicclassExceptionTest {
publicstaticvoidmain(String[] args) {
intnumber;
Stringstr;
try
{
str = "xyz";
number = Integer.parseInt(str);
System.out.println("A");
}
catch(NumberFormatExceptione)
{
System.out.println("B");
}
catch(IllegalArgumentExceptione)
{
System.out.println("C");
}
System.out.println("D");
}
/*
* The program will output:
* B
* D
* */
}