Java SE 8 Programmer I — Question 215
Which three statements are true about the structure of a Java class? (Choose three.)
Answer options
- A. A public class must have a main method.
- B. A class can have only one private constructor.
- C. A method can have the same name as a field.
- D. A class can have overloaded static methods.
- E. The methods are mandatory components of a class.
- F. The fields need not be initialized before use.
Correct answer: C, D, F
Explanation
Options C, D, and F are correct because a method can indeed share a name with a field, classes can have static methods that are overloaded, and fields do not have to be initialized before they are used. Options A, B, and E are incorrect; a public class does not require a main method, a class can have multiple private constructors, and methods are not mandatory for a class.