Top Posters
Since Sunday
r
4
L
4
3
d
3
M
3
l
3
V
3
s
3
d
3
a
3
g
3
j
3
New Topic  
Crystalboo92 Crystalboo92
wrote...
Posts: 545
4 years ago
Analyze the following code:

class Test {
public static void main(String[] args) {
try {
int zero = 0;
int y = 2/zero;
try {
String s = "5.6";
Integer.parseInt(s); // Cause a NumberFormatException
}
catch(Exception e) {
}
}
catch(RuntimeException e) {
System.out.println(e);
}
}
}


▸ The program has a compilation error because Exception appears before RuntimeException.

▸ A try-catch block cannot be embedded inside another try-catch block.

▸ A good programming practice is to avoid nesting try-catch blocks, because nesting makes programs difficult to read. You can rewrite the program using only one try-catch block.

▸ None of the above.
Textbook 
Introduction to Java Programming, Comprehensive Version

Introduction to Java Programming, Comprehensive Version


Edition: 10th
Author:
Read 40 times
1 Reply
Replies
Answer verified by a subject expert
Steve T.Steve T.
wrote...
Posts: 362
4 years ago
Sign in or Sign up in seconds to unlock everything for free
More solutions for this book are available here
1

Related Topics

Crystalboo92 Author
wrote...

4 years ago
this is exactly what I needed
wrote...

Yesterday
This helped my grade so much Perfect
wrote...

2 hours ago
This site is awesome
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  1392 People Browsing
Related Images
  
 227
  
 320
  
 18847
Your Opinion
What's your favorite funny biology word?
Votes: 401