correct answer is C.
public static void main(String[] args) {
try {
int num = 10;
int div = 0;
int ans = num/div;
}catch(ArithmeticException ae) {
ans = 0 // Pay attention! No semicolon after zero !!
}catch(Exception e) {
System.out.println("Invalid calculation");
}
System.out.println("Answer = " + ans);
}
public static void main(String[] args) {
try {
int num = 10;
int div = 0;
int ans = num/div;
}catch(ArithmeticException ae) {
ans = 0;
}catch(Exception e) {
System.out.println("Invalid calculation");
}
System.out.println("Answer = " + ans);
}
"ans" can't be resolve because is out of the block where was declared.
upvoted 12 times
...
...
This section is not available anymore. Please use the main Exam Page.1z0-808 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
SamAru
Highly Voted 4 years, 11 months agoMPignaProTech
Most Recent 6 months, 4 weeks agoMPignaProTech
7 months, 1 week agoOmar_Deeb
1 year, 9 months agodsms
1 year, 9 months agodsms
1 year, 9 months agoVicky_65
2 years, 1 month agocarloswork
2 years, 7 months agojuipeng
2 years, 12 months agoWinston123
3 years agoEmilioDeBaku
3 years, 11 months agomachineallen
4 years agoJimmyson
3 years, 6 months agoKittyyyy
3 years, 5 months agonotkniram
4 years, 6 months agonotkniram
4 years, 6 months agov323rs
5 years, 4 months agobrianhuang881215
3 years, 9 months agoJoseCG
5 years, 7 months agoJoseCG
5 years, 3 months ago