Oracle
1Z0-809 · Question #156
Given the code fragment: public class Test { void readCard(int cardNo) throws Exception { System.out.println("Reading Card"); } void checkCard(int cardNo) throws RuntimeException { // line n1…
The correct answer is C. Compilation fails only at line n3. You've hit your session limit · resets 10:20pm (America/New_York)
Question
Given the code fragment:
public class Test {
void readCard(int cardNo) throws Exception {
System.out.println("Reading Card");
}
void checkCard(int cardNo) throws RuntimeException { // line n1
System.out.println("Checking Card");
}
public static void main(String[] args) {
Test ex = new Test();
int cardNo = 12344;
ex.checkCard(cardNo); // line n2
ex.readCard(cardNo); // line n3
}
}
What is the result?
Options
- ACompilation fails only at line n2.
- BCompilation fails at both line n2 and line n3.
- CCompilation fails only at line n3.
- DCompilation fails only at line n1.
- EReading Card
- FChecking Card
How the community answered
(21 responses)- B5% (1)
- C76% (16)
- D10% (2)
- E10% (2)
Explanation
You've hit your session limit · resets 10:20pm (America/New_York)
Community Discussion
No community discussion yet for this question.