Java SE 8 Programmer I — Question 103
Which three statements are true about the structure of a Java class? (Choose three.)
Answer options
- A. A class cannot have the same name as its field.
- B. A public class must have a main method.
- C. A class can have final static methods.
- D. A class can have overloaded private constructors.
- E. Fields need to be initialized before use.
- F. Methods and fields are optional components of a class.
Correct answer: C, D, F
Explanation
Option C is correct as Java classes can indeed have final static methods. Option D is also correct because a class can have multiple private constructors with different parameters. Option F is correct since methods and fields are optional, meaning a class can exist without them. Options A, B, and E are incorrect because a class can have the same name as its field, a public class does not need a main method, and fields do not necessarily need to be initialized before use.