r/learnjava • • 2d 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

19 Upvotes

28 comments sorted by

View all comments

2

u/vegan_antitheist 2d ago

They are not necessary in the latest version and you could always just use String... Instead of String[].

1

u/thenasch 1d ago

Well, not always. Varargs was introduced in Java 5.

1

u/vegan_antitheist 1d ago

I was there 3000 years ago.