java constructor

Java
Code that runs whenever an object is made 

example:

class bruh{
    
    bruh(){
        //code 
    }
};

int main()
{
    bruh bruhobject(); 
//can take parameters, code runs whenever object is created

}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
    }
}class MyClass {
  public MyClass () {
    //constructor code
  }
}
Source

Also in Java: