Given two files:
1. package com; 2. public class MyClass { 3. public static void howdy() { System.out.print("howdy "); } 4. public static final int myConstant = 343; 5. public static final MyClass mc = new MyClass(); 6. public int instVar = 42; 7. } /* w ww .j a v a 2 s .com*/ 11. import static com.MyClass.*; 12. public class Main { 13. public static void main(String[] args) { 14. System.out.print(myConstant + " "); 15. howdy(); 16. System.out.print(mc.instVar + " "); 17. System.out.print(instVar + " "); 18. } }
What is the result? (Choose ALL that apply.)
F is correct.
Line 17 is incorrect syntax to access instVar
.
All of the remaining code is legal.
It's legal to use static imports to access static methods, constants (which are static and final), and static object references.