Oracle
1Z0-809 · Question #95
1Z0-809 Question #95: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #95. The question stem and answer options stay visible for context.
Question
Given:
public class Test3 {
public static void main(String[] args) {
String names[] = new String[3];
names[0] = "Marry Brown";
names[1] = "Nancy Red";
names[2] = "Jessy Orange";
for (String n: names) {
try {
String pwd = n.substring(0, 3)+n.substring(6,10);
System.out.println(pwd);
}
catch(StringIndexOutOfBoundsException zie) {
System.out.println("String out of limits");
}
}
catch(ArrayIndexOutOfBoundsException e) {
System.out.println("Array out of limits");
}
}
}
What is the result?
Options
- AMarrown String out of limits JessOran
- BMarrown String out of limits
- CMarrown String out of limits
- DMarrown NanRed JesOran
Unlock 1Z0-809 to see the answer
You've previewed enough free 1Z0-809 questions. Unlock 1Z0-809 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.