how to create a constructor in java

Java
class Other{
    public Other(String message){
        System.out.println(message);
    }
}

class scratch{
    public static void main(String[] args) {
        Other method = new Other("Hey");
        //prints Hey to the console
    }
}
Source

Also in Java: