Question

Which of the following statements is incorrect in reference to Java?

A A constructor has the same name as the class; a method can have any name
B A constructor has no return type (not even void); a method must have a return type (or void)
C A constructor is called automatically when an object is created; a method is called explicitly
D A constructor can be declared with a 'void' return type to indicate it returns nothing
E A constructor can be overloaded (multiple constructors with different parameters); methods can also be overloaded
Practice Next

Relevant for Exams:

Hey! Ask a query