nerdexam
Oracle

1Z0-803 · Question #10

Given: What three modifications, made independently, made to class greet, enable the code to compile and run?

The correct answer is C. Line 6 replaced withhandy.dandy.KeyStroke Stroke = new handy.dandy.KeyStroke(); E. import handy.dandy.*;added after line 1 F. import handy.dandy,KeyStroke;added after line 1. Three separate solutions: C: the full class path to the method must be stated (when we have not imported the package) E: We can import the hold dandy class F: we can import the specific method

Java Basics

Question

Given:

What three modifications, made independently, made to class greet, enable the code to compile and run?

Exhibit

1Z0-803 question #10 exhibit

Options

  • ALine 6 replaced with handy.dandy.keystroke stroke = new KeyStroke ( );
  • BLine 6 replaced with handy.*.KeyStroke = new KeyStroke ( );
  • CLine 6 replaced withhandy.dandy.KeyStroke Stroke = new handy.dandy.KeyStroke();
  • Dimport handy.*;addedbeforeline 1
  • Eimport handy.dandy.*;added after line 1
  • Fimport handy.dandy,KeyStroke;added after line 1
  • Gimport handy.dandy.KeyStroke.typeException(); added before line 1

How the community answered

(63 responses)
  • A
    2% (1)
  • B
    8% (5)
  • C
    73% (46)
  • D
    5% (3)
  • G
    13% (8)

Explanation

Three separate solutions: C: the full class path to the method must be stated (when we have not imported the package) E: We can import the hold dandy class F: we can import the specific method

Topics

#packages#import statements#object instantiation#fully qualified names

Community Discussion

No community discussion yet for this question.

Full 1Z0-803 Practice