About Question enthuware.ocpjp.i.v11.2.3040 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
victor2016
Posts: 18
Joined: Wed Jan 20, 2016 7:16 pm
Contact:

About Question enthuware.ocpjp.i.v11.2.3040 :

Post by victor2016 »

Hi,

Should the first correct option for Location 3 be 'public void switchOn()' instead of 'public void reset()' since switchOn() is method in Device interface?

I also ran a test program and it doesn't compile without abstract interface method being implemented in the class that implements the interface.

Thanks,
Victor.

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

Re: About Question enthuware.ocpjp.i.v11.2.3040 :

Post by admin »

But switchOn is already implemented by Router. So, MimoRouter doesn't need to implement it (because MimoRouter extends Router.)

You need to try the code exactly as given in the problem statement.
If you like our products and services, please help us by posting your review here.

victor2016
Posts: 18
Joined: Wed Jan 20, 2016 7:16 pm
Contact:

Re: About Question enthuware.ocpjp.i.v11.2.3040 :

Post by victor2016 »

Thank you for clarifying. I am puzzled why Router class is not stating that it's implementing Device though. I ran code exactly as in the question and it compiles fine with and without "implements Device" at Location 1.

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

Re: About Question enthuware.ocpjp.i.v11.2.3040 :

Post by admin »

Why do you think any class must implement an interface?
If you like our products and services, please help us by posting your review here.

victor2016
Posts: 18
Joined: Wed Jan 20, 2016 7:16 pm
Contact:

Re: About Question enthuware.ocpjp.i.v11.2.3040 :

Post by victor2016 »

There is switchOn() in Router class and switchOn() in Device interface and a placeholder location 1. This leads me to think it's part of a question requirements for Router class to implement Device interface. And since it is MimoRouter that's implementing Device it leads me to think switchOn() should be implemented by MimoRouter. What am I missing?

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

Re: About Question enthuware.ocpjp.i.v11.2.3040 :

Post by admin »

Yes, logically it makes sense for Router to implement Device. But there is no such technical requirement imposed by Java. It might be a "business" requirement but a business requirement cannot be imposed by Java.

MiMo says it implements Device and so, it is required by Java to have switchOn() method (or declare itself as abstract). In this case, MiMoRouter does have a switchOn method (because of inheritiance). So, there is no problem.
If you like our products and services, please help us by posting your review here.

victor2016
Posts: 18
Joined: Wed Jan 20, 2016 7:16 pm
Contact:

Re: About Question enthuware.ocpjp.i.v11.2.3040 :

Post by victor2016 »

Thank you :thumbup:

Post Reply

Who is online

Users browsing this forum: No registered users and 70 guests