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?
You are trying to call a method called
Demowhich you haven’t defined.e.g.
If you want a constructor to call another you need to use
this()like