Need of String args[] in main()
Hai all, i had a small doubt regarding the usage of String args[] in main function. When we are not passing any parameters to the program also, we have to give this String args[]. why should we do so. I mean when we pass some arguements to the program then there is the usage of String args[] but when we are not passing also, we have to give String args[] in the main function. why is it made mandatory?
[411 byte] By [
autoa] at [2007-10-3 5:56:11]

There is only one method signature that the JVM will call. This is part of the Java specification.
The String[] args parameter represents the command line arguments. If there were none, the array will be empty.
Think about it: imagine there were two versions, one with and one without the String[] args parameter, and your application doesn't expect any command line arguments, so it implements only the version with no parameter at all. What would happen if the user decides to provide some command line arguments just for fun?