Oracle
1Z0-809 · Question #274
1Z0-809 Question #274: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #274. The question stem and answer options stay visible for context.
Question
QUESTION 298
Given:
public class Emp {
public void calcLeave() {
System.out.println("12");
}
}
and the code fragment:
public class TestAnn {
public static void main (String[] args) {
// insert code here
e.calcLeave();
}
}
Which code fragment can be inserted to print 13?
Options
- AEmp e = () -> { public void calcLeave() { System.out.println("13"); } };
- BEmp e = new Emp() { public void calcLeave() { System.out.println("13"); } };
- CEmp e = new Emp{ public void calcLeave() { System.out.println("13"); } } ();
- DEmp e = new Emp() { (static class Emp { public void calcLeave() { System.out.println("13"); } });
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.