Java syntax: Difference between revisions

Content deleted Content added
Static import declaration: Add main article
main method: Add main article.
Line 268:
 
===<code>main</code> method===
{{Main|Entry point#Java}}
 
Every Java application must have an entry point. This is true of both graphical interface applications and console applications. The entry point is the <code>main</code> method. There can be more than one class with a <code>main</code> method, but the main class is always defined externally (for example, in a [[manifest file]]). The <code>main</code> method along with the main class must be declared <code>public</code>. The method must be <code>static</code> and is passed command-line arguments as an array of strings. Unlike [[C++]] or [[C Sharp (programming language)|C#]], it never returns a value and must return <code>void</code>.
<syntaxhighlight lang=Java>