Java requires the main() method to be static. C and C++ however don't require such. Why?
<p>Let's look at the method signature of main() in C, C++ and Java without paying much attention to it.</p>

<p>C and C++ take the syntax of the main() function something like the one shown below.</p>

<pre><code>int main(void)
{
     //Elegant code goes here.

     return(0); 
} 
</code></pre>

<p>or it can simply be declared void as shown below.</p>

<pre><code>void main(void)
{

     //Elegant code goes here.

} 
</code></pre>

<p>The main() function in C and C++ can optionally takes two command-line arguments, if needed.</p>

<hr>

<p>The signature of the main() method in Java however, something like this.</p>

<pre><code>public static void main(String []args)
{

    //Elegant Java code goes here.
}
</code></pre>

<hr>

<p>Java requires the main() method to be static simply because it was clearly mentioned that it is the first method to be invoked when no objects were created hence, it must be static. The same thing is also applicable to C and C++. There also the main() function is the first function to be invoked still they don't require the main() function to be static. Why? Why did the Java designers take somewhat different view to implement the main() method in Java?</p>
