How have the right to you explain really well, come a beginner, the meaning of string args<> and also the usage of revolution in the complying with excerpt?

class FirstApp public revolution void main(String<> args) ...



I would break up

public revolution void main(String args<>)in parts:


It method that you can speak to this method from outside of the class you are at this time in. This is necessary since this method is being referred to as by the Java runtime device which is not located in your current class.

You are watching: What does public static void main(string args) mean


When the JVM makes speak to to the main an approach there is no object existing for the class being called as such it has to have static method to allow invocation indigenous class.


Java is platform independent language and if it will certainly return some worth then the value may mean various things to various platforms. Likewise there space other methods to exit the program on a multithreaded system. Thorough explaination.


It"s just the surname of method. This name is fixed and as it"s called by the JVM together entry allude for an application.

String args<>

These space the disagreements of form String that your Java application accepts as soon as you run it.

edited Jun 20 "20 in ~ 9:12

111 silver badge
answered Feb 11 "15 at 14:33

5,08666 yellow badges3333 silver- badges5757 bronze title
include a comment |
I would point a beginner to the Wiki short article on the key function, then supplement it with this.

Java only starts running a regimen with the specific public static void main(String<> args) signature, and also one have the right to think of a signature choose their very own name - it"s exactly how Java deserve to tell the difference in between someone else"s main() and also the one true main().

String<> args is a collection of Strings, separated by a space, which have the right to be typed right into the regimen on the terminal. More times 보다 not, the beginner isn"t walking to use this variable, but it"s always there simply in case.

edited Feb 2 "15 at 14:32

Simone Carletti
166k4242 gold badges345345 silver- badges358358 bronze badges
answer Aug 14 "12 in ~ 13:11
98.1k2424 yellow badges172172 silver badges215215 bronze badges
What perform you median by "more times 보다 not"??
Dec 14 "16 in ~ 18:11
what is it's use once it's never used at every . Why place it onl
Dec 14 "16 at 18:54
Dec 14 "16 at 18:55
| present 4 much more comments
public revolution void main(string <> args)public -its the access specifier method from every whereby we can access it;static -access modifier means we can call this an approach directly making use of a class name there is no creating an object of it;void- the the return type;main- technique namestring <> args - it accepts just string type of argument... And stores it in a cable array

edited Jun 26 "18 at 21:30
6,33344 gold badges2222 silver- badges4040 bronze title
answered Jul 11 "14 at 18:08
15911 silver badge22 bronze badges
include a comment |
public : it is a access specifier that method it will be accessed through publically.static : that is accessibility modifier that method when the java program is load then it will produce the an are in memory automatically.void : the is a return type i.e it does no return any type of value.main() : that is a method or a duty name.string args<> : that is a command line debate it is a repertoire of variables in the wire format.
edited Oct 17 "14 at 14:15
4,6011515 yellow badges3838 silver- badges5555 bronze badges
reply Oct 17 "14 at 12:58
Aishwarya HungundAishwarya Hungund
9911 silver- badge11 bronze badge
add a comment |
If i were explaining this to who I"d to speak we"ll acquire to it later on for now you need to recognize that the way to operation your routine is to usage :

public static void main(String<> args) ... Assuming he/she knows what selection is, I"d speak the args is an debate array and also you can display some cool examples.

Then after ~ you"ve gone a bit around Java/JVM and also that stuff, you"d gain to modifiers eventually to static and also public together well.

Then you deserve to spend some time talking about definition of this IMHO.

You could cite other "cool" stuff such together varargs the you have the right to use this in later on versions of Java.

public static void main(String ...args) //...
edited Aug 14 "12 at 14:02
answer Aug 14 "12 in ~ 13:41
22k3535 gold badges126126 silver- badges177177 bronze badges
add a comment |
I just thought I"d chip in on this one. It"s been answered perfectly fine by others though.

The complete main technique declaration must be :

public static void main(final String<> args) throws exception The args are declared final because technically they need to not it is in altered. They are console parameters provided by the user.

You should usually point out that main throws exception so that stack traces deserve to be echoed to console quickly without needing to perform e.printStackTrace() etc.

As for array Syntax. I choose it this way. I expect that it"s a small bit like the difference between french and also english.In English it"s "a black color car", in french it"s "a vehicle black".Which is the necessary noun, car, or black?

I don"t prefer this type of point :

String blah<> = ;What"s vital here is that it"s a cable array, so it should be

String<> blah = ;blah is just a name. I personally think it"s a little of a mistake in Java that arrays have the right to sometimes be claimed in the manner.

reply Feb 11 "15 at 15:04
91288 silver- badges1818 bronze title
add a comment |
To store beginner perspective you can explain that every the command line is automatically split into variety of cable (the String<>).

For revolution you have to explain, that it not a ar like an additional : it is unique in the JVM also if you have actually thousand instances the the class

So main is static, since it is the only way to uncover it (linked in its own class) in a jar.

See more: Is The Five Heartbeats A Real Group, Who Is The Real Big Red Davis

after girlfriend look in ~ coding, and your job begin .

edited Aug 2 at 11:34
KR Akhil
56733 gold badges1111 silver badges3030 bronze badges
answered Aug 14 "12 at 13:09
1,2541212 silver- badges2424 bronze title
include a comment |
The normal intake of revolution is to accessibility the duty directly with out any kind of object creation. Same as in java key we could not create any type of object for that course to invoke the main method. It will execute automatically. If we want to execute manually we can call by making use of main() inside the class and ClassName.main from outside the class.

answer Aug 27 "12 in ~ 7:25
1,37744 yellow badges2121 silver- badges3737 bronze badges
add a comment |

Not the price you're feather for? Browse various other questions tagged java main or ask your very own question.

The Overflow Blog
Featured top top Meta
What is "String args<>"? parameter in main an approach Java
the an interpretation of “public revolution void(string<> args)”
What is the definition of public static void main(String<> args)?
Why is main() in java void?
What does "String<> args" contain in java?
Why room command line disagreements passed together a String range in Java?
How java interpreter picks up main role even when it is put in within class?
java.nio.file not workin in java 8
My password isn't working
Member duty accepts worths when dubbed separately but not when dubbed in main function
See more linked questions
Java inner class and also static nested class
Why is the Java main method static?
What is the difference between public, protected, package-private and private in Java?
performance of Java "Double Brace Initialization"?
Why use getters and also setters/accessors?
exactly how to usage to fire and also handle HTTP inquiry
Where do I put public static void main(String<> args)?
just how to make JFrame and also JMenubar not in public static void main(String<> args)
hot Network questions an ext hot concerns
stack Overflow
stack Exchange Network
site architecture / logo © 2021 stack Exchange Inc; user contributions license is granted under cc by-sa. Rev2021.11.5.40661

Stack Overflow works ideal with JavaScript enabled

her privacy

By clicking “Accept all cookies”, friend agree ridge Exchange deserve to store cookie on your device and disclose details in accordance with our Cookie Policy.