Java OCA OCP Practice Question 553

Question

Which represent the order in which the following statements can be assembled into a program that will compile successfully?

Choose all that apply

A: class Main {}  
B: import java.util.*;  
C: package animals; 
  • A. A, B, C
  • B. B, C, A
  • C. C, B, A
  • D. B, A
  • E. C, A
  • F. A, C
  • G. A, B


C, D, E.

Note

package and import are both optional.

If both are present, the order must be package, then import, then class.

Option A is incorrect because class is before package and import.

Option B is incorrect because import is before package.

Option F is incorrect because class is before package.

Option G is incorrect because class is before import.




PreviousNext

Related