java this(null)

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) {
    //...
}

It means you are calling an overloaded constructor which takes an Object of some sort but you do not pass an object, but a plain null.


It's a constructor that is calling another constructor in the same class.

You presumably have something like this:

public class Settings {
    public Settings() {
        this(null);  // <-- This is calling the constructor below
    }

    public Settings(object someValue) {
    }
}

Often this pattern is used so that you can offer a constructor with fewer parameters (for ease of use by the callers) but still keep the logic contained in one place (the constructor being called).

Tags:

Java

This