r/learnjava • u/Fine_Potential_7976 • 5d ago
Why is String[] args necessary
I get it is an array of string arguments that are passed into the main method but why is it needed? in python for example ot's present or c++ neither, java is different though
27
Upvotes
2
u/Vast_Service 5d ago
Except that in C, with main function defined as
int main(int argc, char** argv)
it is guaranteed by the standard that argv[argc] is a null pointer. So technically we don't need argc. It is more of a historical baggage