subject

Consider the following code (assume that comments are replaced with real code that works as speciied): public class TestExceptions {
static void e() {
// Might cause any of the following unchecked exceptions to be
// thrown:
// Ex1, Ex2, Ex3, Ex4
}
static void April() { try {
e();
} catch (Ex1 ex) { System. out. println("April caught Ex1");
}
}
static void March() {
try {
April();
} catch (Ex2 ex) { System. out. println("March caught Ex2");
// now cause exception Ex1 to be thrown
}
}
static void February() {
try {
March();
} catch (Ex1 ex) { System. out. println("February caught Ex1");
} catch (Ex3 ex) { System. out. println("February caught Ex3");
}
}
static void a() { try {
February();
} catch (Ex4 ex) {
System. out. println("January caught Ex4");

// now cause exception Ex1 to be thrown
} catch (Ex1 ex) { System. out. println("January caught Ex1");
}
}
public static void main(String[] args) { January();
}
}

Assume now that this program is run four times. The first time, method throws exception Ex1, the second time, it throws exception Ex2, etc.

What are the results of the four runs (a or b)?

a.
1. The program prints: April caught Ex1
2. The program prints: March caught Ex2 February caught Ex1
3. The program prints: February caught Ex3
4. The program prints: January caught Ex4
And execution stops due to an uncaught exception Ex1 thrown in
main()

b.
1. The program prints: April caught Ex3
2. The program prints: March caught Ex2 February caught Ex2
3. The program prints: March caught Ex3
4. The program prints: January caught Ex4
And execution stops due to an uncaught exception Ex1 thrown in
main()

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 00:30
If joey was single and his taxable income was $9,500, how much would he pay in taxes each year?
Answers: 1
question
Computers and Technology, 23.06.2019 04:31
Q14 what is most important for you to choose before you build a network? a. private network b. nos c. network media d. network protocol e. directory service
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
In the blank libreoffice writer document, to start the process of entering a date field into a letter, click on the insert menu. edit menu. file menu. fields menu.
Answers: 3
question
Computers and Technology, 23.06.2019 18:50
What is transmission control protocol/internet protocol (tcp/ip)? software that prevents direct communication between a sending and receiving computer and is used to monitor packets for security reasons a standard that specifies the format of data as well as the rules to be followed during transmission a simple network protocol that allows the transfer of files between two computers on the internet a standard internet protocol that provides the technical foundation for the public internet as well as for large numbers of private networks
Answers: 2
You know the right answer?
Consider the following code (assume that comments are replaced with real code that works as speciied...
Questions
question
Mathematics, 14.10.2021 22:10
question
Mathematics, 14.10.2021 22:10
question
Mathematics, 14.10.2021 22:10
question
Mathematics, 14.10.2021 22:10
Questions on the website: 13722363