alternate constructor java without this code example
Example 1: constructor in js
A constructor is a function that creates an instance of a class
which is typically called an “object”. In JavaScript, a constructor gets
called when you declare an object using the new keyword.
The purpose of a constructor is to create an object and set values if
there are any object properties present.
Example 2: how to create a constructor in java
class Other{
public Other(String message){
System.out.println(message);
}
}
class scratch{
public static void main(String[] args) {
Other method = new Other("Hey");
}
}