Exam Permalink:
https://www.jobilize.com/java-certification-questions
Question Permalink:
https://www.jobilize.com/java-static-imports
Question 258 / 297:  Which of following import statement will allow to compile code correctly
Choose 2
package pkg;

public enum Signal{GET , SET, GO}

class Import_Enum2

{

public static void main(String... arg)

{

System.out.println(SET);

}

}

<< First < Previous Next > Last >>
Explanation:

correct syntax for static import is

import static pkg1.pkg2..pkgn.static_member;

or

import static pkg1.pkg2..pkgn.enclosingcontext.*;

note:

enclosingcontext can be class, enum, or interface..

in this case it is enum.

Exam Home Page
https://www.jobilize.com/java-certification-questions

Oracle Certified Professional Java Programmer

Author:

Access: Public Instant Grading

Ask
Candice Butts
Start Quiz
Danielrosenberger
Start Quiz
Yacoub Jayoghli
Start Quiz
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/java-certification-questions" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>