I want to know what does this means?
public Settings() {
this(null);
}
The above code is the constructor of a class "Settings". What does this(null) means here?
public Settings() {
this(null); //this is calling the next constructor
}
public Settings(Object o) {
// this one
}
This is often used to pass default values so you can decide to use one constructor or another..
public Person() {
this("Name");
}
public Person(String name) {
this(name,20)
}
public Person(String name, int age) {
//...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With