If there is no constructor then default is constructor without arguments.
public class HelloWorld{
HelloWorld(){
System.out.println("test"+ l);
}
public static void main(String []args){
System.out.println("Hello World");
new HelloWorld();
}
}
Result
Hello World test
But if you add a single char with argument then that's the only constructor you have. Defaults are gone.
public class HelloWorld{
HelloWorld(String l){
System.out.println("test");
}
public static void main(String []args){
System.out.println("Hello World");
new HelloWorld();
}
}
Result
HelloWorld.java:7: error: constructor HelloWorld in class HelloWorld cannot be applied to given types; new HelloWorld(); ^ required: String found: no arguments reason: actual and formal argument lists differ in length 1 error