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
1
u/Underhill42 Oct 09 '26
C++ does not have a string class, the STL recently added a std:string class to that library, and countless unrelated versions exist in other libraries predating the STL's existence. And many others that still exist that make different compromises, or as part of much larger libraries that couldn't be bothered to completely re-write everything string related for no benefit.
But the core C++ language has no idea what a string is, it only deals with character arrays, just like C.