Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default constructor call InterfaceConstructor with null

Tags:

java

I try to do this:

public class Demo{
public Demo() {
    Demo(null)
}
public Demo(Interface myI) {
    ...
}
}

I would like the Demo() constructor to call the Demo(Interface) constructor with null however eclipse complains "Demo(null) is undefined" on the line where I call Demo(null). What do I have to change?

like image 852
ted Avatar asked Dec 15 '22 17:12

ted


1 Answers

It shouldn't be Demo(null) but this(null)

like image 57
MByD Avatar answered Feb 07 '23 05:02

MByD