Main Function

I am Very New to JavaWhy we write (String args[]) in the public Static void main?Is it Compulsory?
[119 byte] By [Hitesh_kumara] at [2007-10-3 0:53:52]
# 1
We are passing the command-line arguments through this array. It is compulsoryif you are writing a stand-alone application. If the you are giving a main method without any argument then it takes it as an ordinary member function.
Janeve_Reckonera at 2007-7-14 17:49:07 > top of Java-index,Java Essentials,New To Java...
# 2
Read in the [url= http://java.sun.com/docs/books/jls/third_edition/html/execution.html#12.1.4]JLS[/url]
PhHeina at 2007-7-14 17:49:07 > top of Java-index,Java Essentials,New To Java...
# 3

The Java runtime only recognizes one(*) method signature as the starting point of an application:public static void main(String[] args)

. Any other signature might be perfectly legal, but it won't be recognized as the starting point of an application.

(*) some variants of the signature with different access modifiers have been known to work in various versions of Java

Herko_ter_Horsta at 2007-7-14 17:49:07 > top of Java-index,Java Essentials,New To Java...