About Question enthuware.ocajp.i.v7.2.945 :

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
Statics
Posts: 6
Joined: Sat Aug 10, 2013 1:54 pm
Contact:

About Question enthuware.ocajp.i.v7.2.945 :

Post by Statics »

I was really confused about 2nd point - "A subclass can override any method in a non-final superclass". Even if "subclasses are allowed to define a new method with exactly the same signature", do they override methods of superclass?

Moreover, Java compiler fails to compile such code:

Code: Select all

    class A {
        private void doStuff(){}
    }

    class B extends A {
        @Override
        private void doStuff(){}
    }
So maybe it make sense to correct somehow this answer?

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

Re: About Question enthuware.ocajp.i.v7.2.945 :

Post by admin »

This option seems be mistakenly set as correct because the explanation to this option says:
Only the methods that are not declared to be final can be overridden. Further, private methods are not inherited so they cannot be overridden either.
This has now been fixed.

thank you for your feedback!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest