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, 22.06.2019 21:00
So im doing this school challenge and the teachers said whats the average text a student gets a day so i need to get about 20 in a day but dont know how can you guys 2163371293
Answers: 2
question
Computers and Technology, 22.06.2019 23:00
Which factor is the most important when choosing a website host? whether customers will make secure transactions the number of email accounts provided the purpose of the website the quality of the host control panel
Answers: 3
question
Computers and Technology, 24.06.2019 11:20
Every telecommunication setup uses two devices: one device to transmit data and one device to receive data. which device transmits frequencies to mobile phones? towers transmit frequencies to mobile phones.
Answers: 1
question
Computers and Technology, 24.06.2019 17:50
Create a class hand in its own module. one object of class hand represents a hand of cards and so one object stores a number of card objects. for this assignment you will submit three separate modules, one with the definition of class card, one with the definition of class hand and one with the main application that thoroughly tests class hand.class hand must contain the following four methods: 1) , numcardsinhand) takes an integer as parameter and initializes a hand object with numcardsinhand card objects inside it. these card objects are generated randomly. for simplicity, assume an infinite number of decks of cards.2) bjvalue(self) returns the blackjack value for the whole hand of cards3) ) returns a string containing all the cards in the hand4) hitme(self) adds one randomly generated card to the handcreate a main program in its own module that thoroughly tests class hand. you will have three modules/files to upload to your etudes assignment submission: card.py, hand.py and the module that contains your main program.two alternatives for extra credit - you cannot get credit for both! (+1 point): after you have thoroughly tested the class hand and all of its methods, add code to your main program that stores one hand object as a pickle file and reads it back into a new hand object. you are only eligible for this extra credit if class hand has all four of the methods above working.or(+2 points): after you have thoroughly tested the class hand and all of its methods, add code to your main program that stores one hand object as a text file on the disk and reads it back into a new hand object. you are only eligible for this extra credit if class hand has all four of the methods above working.notes: -start by making any and all modifications suggested by my comments to your previous submission of class card from assignment #6 "a robust card object"-once your class card is tested and working well, you will not make any further modifications to it for the purposes of class hand.-you can keep the test code for class card intact. if it is indented inside an if __name__ == "__main__", then it will not be executed when your main program's module imports it.-to save time, write and test one method for class hand at a time.-under no circumstances are you to attempt the extra credit until you are completely finished with writing and testing all the methods in class hand.
Answers: 3
You know the right answer?
Consider the following code (assume that comments are replaced with real code that works as speciied...
Questions
question
Mathematics, 22.04.2020 20:07
question
Mathematics, 22.04.2020 20:07
question
History, 22.04.2020 20:08
Questions on the website: 13722360