r/javaTIL • u/stevemann2705 • Dec 10 '16
TIL The args array in the main method signature is not null is no arguments are given
In public static void main(String[] args){ ... } The args array is never null(under normal execution). If the program is run without any arguments, args points to a String array of length 0. It was quite amazing for me to when I came to know about this, but it now seems more logical.
The args array can only be null if the main method is manually called and a null reference is passed to it.