public class Class1 {
public Class1() {
// Initialization of Class1
}
}
public class Class2 {
// Startup method
public static void main(String[] args) {
Class1 class1 = new Class1(); // Initialize Class1
}
}
ClassName className = new ClassName();
When you run the " New ClassName(); ", that is when you
initialize the class. It creates a new instance of the class
and also run the
public ClassName() {
}
in the class.