Exam 1z0-808 All QuestionsBrowse all questions from this exam
Question 98

Which three statements are true about the structure of a Java class? (Choose three.)

    Correct Answer: C, D, F

    A method can indeed have the same name as a field within a class. A class can have overloaded static methods, meaning the same method name can be used but with different parameters. Fields in a class do not need to be initialized before use; they will take default values if not explicitly initialized.

Discussion
iSnoverOptions: CDF

Correct is CDF, A and E are wrong because you can create empty classes without problems. You can overload static methods (D) and The fields not necessarily need be ubutialized before use.

Bramagon

Don't agree with D. Static methods can't be overwritten, they can only be hidden. There are only 2 right answers here imo

Harch

It says overloaded, not overwritten. It's not the same.

dsmsOptions: BCD

Answer is BCD: A. A public class must have a main method. - FALSE B. A class can have only one private constructor. - TRUE C. A method can have the same name as a field. - TRUE D. A class can have overloaded static methods. - TRUE E. The methods are mandatory components of a class. - FALSE F. The fields need not be initialized before use. - FALSE

dsms

Sorry, CDF is correct

fvelazqueznavaOptions: CDF

CDF IS THE CORRECT

DarGrinOptions: CDF

CDF are correct

Alok1105Options: CDF

CDF is correct. Below is code. package exam_javase1; public class ClassBehavior { //can have overloaded static methods static int proof() { return 1; } static int proof(int a) { return a; } //can have method name same as variable name int sum; int sum() { //fields not necessarily needs to be initialed before use return sum+=1; } //can have multiple private constructor private ClassBehavior() { } private ClassBehavior(int a) { } void methodA() { System.out.println("Inside A"); } //No main method required }

tuyetanOptions: CDF

CDF Question #96 is an example for D