I wonder why there is no error when writing the main
default method and executing it without passing any argument, even with the String[]args
as a parameter, eg:
package prueba;
class Prueba{
public static void main(String[]args){
System.out.print("Hola");
}
}
However, any Java API method you use requires you to pass default parameters to it, or it fails.
The arguments that are passed to that method are established in the Project properties, in case you do not indicate any argument, an empty String array will be sent, this is done internally by the IDE that you use.
In the event that you want to call the main method of that class from another class, you will see that you must inform the parameter.
In case you are running the class from the command line, you can specify the arguments after the class name: C> java Test argument1 argument2 argument3 ...
All the best.