Java OCA OCP Practice Question 51

Question

Which of the following lines of code is not allowed as the first line of a Java class file?

A.   import widget.*; 
B.   // Widget Manager 
C.   package sprockets; 
D.   int facilityNumber; 


D.

Note

A class can start with a comment, an optional package statement, or an import statement if there is no package statement.

It cannot start with a variable definition, making Option D the correct answer.




PreviousNext

Related