Oracle
1Z0-803 · Question #169
1Z0-803 Question #169: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-803 to reveal the answer and full explanation for question #169. The question stem and answer options stay visible for context.
Question
Given: package handy.dandy; public class Keystroke { public void typeExclamation() { System.out.println("!"); } } And 1. package handy; 2. public class Greet { 3. public static void main(String[] args) { 4. String greeting = "Hello"; 5. System.out.print(greeting); 6. Keystroke stroke = new Keystroke(); 7. stroke.typeExclamation(); 8. } 9. } What three modifications, made independently, enable the code to compile and run?
Options
- Aline 6 replaced with handy.dandy.Keystroke stroke = new Keystroke();
- Bline 6 replaced with handy.*.Keystroke stroke = new Keystroke();
- Cline 6 replaced with handy.dandy.Keystroke stroke = new handy.dandy.Keystroke();
- Dimport handy.*; added before line 1
- Eimport handy.dandy.*; added after line 1
- Fimport handy.dandy.Keystroke; added after line 1
- Gimport handy.dandy.Keystroke.typeExclamation(); added before line 1
Unlock 1Z0-803 to see the answer
You've previewed enough free 1Z0-803 questions. Unlock 1Z0-803 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.