About Question enthuware.ocajp.i.v8.2.1012 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
rowan.jones
Posts: 1
Joined: Mon Jan 30, 2017 6:18 am
Contact:

About Question enthuware.ocajp.i.v8.2.1012 :

Post by rowan.jones »

This question doesn't quite make sense to me.

Consider the options written out.

1 must be valid.

2 is a method, not a constructor.

3 would be written like

Code: Select all

public TestClass(String s);
Which is wrong. At first glance you might think it's for an interface, but interfaces don't have constructors.

4 must be correct.

5 would be written like

Code: Select all

public TestClass(String s1, String s2){

};
which is wrong since it has a ; at the end.

I can only see 2 valid constructors in this question.

Could someone enlighten me to the 3rd correct option?

Thanks! :)

admin
Site Admin
Posts: 10386
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1012 :

Post by admin »

Did you read the explanation written below the 5th option?
The compiler ignores the extra semi-colon.
HTH,
Paul.

flex567
Posts: 202
Joined: Mon Apr 02, 2018 8:40 am
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1012 :

Post by flex567 »

The explanation for //3 is that the constructor has empty body.
But all other have empty body (only have brackets)??

admin
Site Admin
Posts: 10386
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1012 :

Post by admin »

It also explains further what it means by empty (it cannot be abstract). I have updated the explanation to make it more clear.

thank you for your feedback!

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests