Skip to Main Content

Java Programming

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!

Superclass with no constructors

857249Apr 22 2011 — edited Apr 23 2011
I am using third party libraries to do my development. The base class I am extending my class from does not have any constructors (with or without arguments). So, during compilation I get the following error message

"Implicit super constructor Foo() is undefined. Must explicitly invoke another constructor."

So, I declared a new constructor with argument in my class but still got the same error message. So, I added the the statement super(); to it. I got the error message

"Constructor Foo() is undefined"

Code Snippet:

public class ChildFoo extends Foo {

String name;

public ChildFoo(String name){
super();
this.name = name;
}
}

Since class Foo() extends from java.lang.Object my assumption was it will invoke the java.lang.Object default constructor since it is chained.
I am at a loss. It has been some years I have coded in java. Any help is appreciated,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 21 2011
Added on Apr 22 2011
8 comments
949 views