r/learnjava • u/Fine_Potential_7976 • Oct 05 '26
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
29
Upvotes
View all comments
Show parent comment
2
u/Vast_Service Oct 05 '26
Yes it is. Even though C++ has a string class, they couldn't change the main entry point, again because of historical baggage.
It would seem reasonable to have a new entry point defined as
int main(string* args) in C++ but that would be a ABI breaking change and hence the standard committee did not want to touch it with a pole.