Oracle
1Z0-851 · Question #22
1Z0-851 Question #22: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-851 to reveal the answer and full explanation for question #22. The question stem and answer options stay visible for context.
Question
Given a class Repetition: package utils; public class Repetition { public static String twice(String s) { return s + s; } } and given another class Demo: 01. public class Demo { 02. public static void main(String[] args) { 03. System.out.println(twice("pizza")); 04. } 05. } Which code should be inserted at line 1 of Demo.java to compile and run Demo to print "pizzapizza"?
Options
- Aimport utils.*;
- Bstatic import utils.*;
- Cimport utils.Repetition.*;
- Dstatic import utils.Repetition.*;
- Eimport utils.Repetition.twice();
- Fimport static utils.Repetition.twice;
- Gstatic import utils.Repetition.twice;
Unlock 1Z0-851 to see the answer
You've previewed enough free 1Z0-851 questions. Unlock 1Z0-851 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.