Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

overridable method call in constructor

800386Jun 16 2010 — edited Jun 21 2010
im wondering why am i having an error with the green line and how should i fix that error:

i have a class:
public class Human {

    public void talk() {
    }
}
and another class:
public class Boy extends Human {

    public Boy() {
        talk(); // error overridable method call in constructor*
    }

    @Override
    public void talk() {
    }
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 19 2010
Added on Jun 16 2010
11 comments
1,674 views