Sunday, 15 January 2012
JAVA : public static void main(String args[]) - Explanation.
Do you like this Article?
public - public means everyone can access it.That means it's in global scope. As, main method is called by JVM [Java Virtual Machine], which is actually out of the project scope, the access specifier of this method is public.
static - Java environment should be able to call this method without creating an instance of the class , so this method must be declared as static.
void - the return type of this method is void means there's no return value.
main( ) - the name of the method, main because it's the main method.
String args[] - arguments to this method. This method must be given an array of Strings, and the array will be called 'args'.
Anijit Sarkar
static - Java environment should be able to call this method without creating an instance of the class , so this method must be declared as static.
void - the return type of this method is void means there's no return value.
String args[] - arguments to this method. This method must be given an array of Strings, and the array will be called 'args'.
RELATED POST ~ JAVA INTERVIEW QUESTIONS
| |
►
| |
►
| |
►
| |
►
| |
►
|
Subscribe to:
Post Comments
(
Atom
)
Popular Posts
-
public - public means everyone can access it.That means it's in global scope. As, main method is called by JVM [ Java Virtual Machine...
-
throw is used to throw an exception in a program, explicitly . Whereas, throws is included in the method's declaration part, wi...
-
Singleton in one of the most popular yet controversial design pattern, in the world of object oriented programming. It's one of t...
-
Web Container / Servlet Container / Servlet Engine : In J2EE Architecture , a web container (also known as servlet container or ser...
-
Program compiles. But at runtime throws an error “NoSuchMethodError”.
-
Vector : It's synchronized. It's slower than ArrayList. It's generally used in ...
-
doGet(): protected void doGet(HttpServletRequest req, HttpServletResponse resp)throws ServletException, java.io.IOException – is a met...
-
In Java Programming Language , we must declare a variable name and type, before using it. The data type of a variable defines the th...
84 Responses to “ JAVA : public static void main(String args[]) - Explanation. ”
14 April 2012 at 13:00
thanx
15 April 2012 at 08:49
@Mubarok
you r welcome my friend!!
thanks for commenting!! :)
18 April 2012 at 15:10
Good explanation. Why main is made public static in Java is also a popular question where this explanation can be used.
15 July 2012 at 22:42
excellent explanation about usage of static in main method......
15 July 2012 at 23:15
@Bharath....
...Thanks a lot my friend!!
19 July 2012 at 18:54
THNX..
27 July 2012 at 11:59
shukriya boss...really worthy explanation
1 September 2012 at 13:50
it was helpful
5 September 2012 at 14:57
i not satisfy with the main() explanation , pls give clearly
14 September 2012 at 06:17
thanks ,it is really helpful............
15 September 2012 at 00:17
We can also use
public static void main(String ...args) instead of
public static void main(String args[])
3 October 2012 at 13:41
yeas Sudhanshu (String args[]) is as same as (String...args)
11 October 2012 at 12:22
thanks friend,very useful info..
public static void main(String []args) this is also one of the method to declare string array.
12 October 2012 at 18:49
Than,s FRND
30 October 2012 at 22:55
what if declare main() as private or protected ?????
5 December 2012 at 08:44
super explain
16 December 2012 at 22:16
can we define main as private or protected?
19 February 2013 at 20:05
main() method tell us the begin of the program execution
17 March 2013 at 17:18
we can define main() as private or protected and ofcourse The program compiles properly but at runtime it will give “Main method not public.” message.
23 March 2013 at 10:23
why should "s" be capitals in "String args[]" ?
6 April 2013 at 21:41
instead of String can we use datatypes like int,char....???
23 April 2013 at 12:39
's' in "String agrs[]" is capital beacause String is the name of class we are using and it should be capital
18 July 2013 at 10:33
What do you mean by public-every one can access it
9 August 2013 at 09:08
can i use private instead of using public
9 August 2013 at 23:16
No!
Main is call by JVM [Java Virtual Machine],
which is actually outside the project,
so, the access specifier of this method must be public.
8 September 2013 at 19:36
Main - JVM has to know the name of the method it is going to run. It could have been called "lollipop"for all the JVM cares as long as it is known and constant.
String[] - running a program from the command line means you can pass arguments to it. This is where those arguments get placed so that your program can handle them.
8 September 2013 at 23:10
Hi, Have one question..
Why the parameter of String[] needs to be passed in the main method, do we use it by somehow?
Please reply.. waiting to hear you soon..
8 September 2013 at 23:40
The parameter of String[] is for for command-line arguments in Java.
Check this link for command-line arguments : http://docs.oracle.com/javase/tutorial/essential/environment/cmdLineArgs.html
Or, in Eclipse also, you can simply try this:
Code:
public class TestMain {
public static void main(String[] args) {
for (int i = 0; i < args.length; i++) {
System.err.println(args[i]);
}
}
}
and now -> Right click -> run as -> run configurations -> select this class -> go to Arguments tab -> write some thing on Program arguments text area -> click apply -> clcik run
your inputs will be printed on eclipse console
3 July 2014 at 21:01
how can jvm enter in default class
in packages if a class is default its public methods cant be acccessed from outside
so if our class is default and we have public static void main(String arg[]){} in it how does jvm accesses this method
26 March 2017 at 12:52
Awesome article thanks a lot for this
23 May 2017 at 15:00
The main() method is the starting point of an application. When a program starts running, it has to start execution from somewhere. That somewhere is called main. Without it, there is no place to start running a Java program.
How the main Method Gets Called?
When the Java interpreter executes an application, it starts by calling the class's main() method. The main method then calls all the other methods required to run your application.
More...Java Interview Questions
Ling
31 May 2017 at 17:05
Welcome Post very usefull informatation.and iam expecting more posts like this please keep updating us........
7 September 2017 at 18:58
thanks for sharing this information Java main method .
19 January 2018 at 17:01
I have read your blog its very attractive and impressive. I like it your blog.
Best Java Course in Chennai
20 April 2018 at 17:48
Hi Mate,
Love it absolutely! So crystalline. No mumbo jumbo. No non-sense. Straight and simple. You guys need a standing ovation for your good work.
I have performed the following steps as a preliminary experiment.
1. Run the program with the jar as is. The program works.
2. Extract a .class file from a jar using 7-zip.
3. Delete that class file from the .jar using 7-zip.
4. Add back the class file extracted above using 7-zip.
5. Run the program with the modified jar. The program does not work.
What is the reason the program does not work after the final step? Is this surprising?
But nice Article Mate! Great Information! Keep up the good work!
Regards,
Krishna kumar
20 June 2018 at 12:37
thanks for sharing the more valuable information.
Indian Cyber Army credibility in Ethical hacking training & Cybercrime investigation training is acknowledged across nation as we offer hands on practical knowledge and full assistance with basic as well as advanced level ethical hacking & cybercrime investigation courses. The training is conducted by subject specialist corporate professionals with wide experience in managing real-time ethical hacking/ cyber security projects. Indian Cyber Army implements a blend of academic learning and practical sessions to give the candidate optimum exposure.
28 July 2018 at 17:20
Great and really helpful article! Adding to the conversation, providing more information, or expressing a new point of view...Nice information and updates. Really i like it and everyday am visiting your site..java training
6 October 2018 at 15:33
Hey, I am really glad I have found this information
NDA Coching in Meerut
Best Colleges in Up
Best Colleges in India
Latest Technology Updates
travel the stunning world
Latest Online Forms
9 October 2018 at 16:47 This comment has been removed by the author.
10 October 2018 at 11:26
Learn java from top training institute of java in Pune Top java training Institute in Pune and get professional java certificate
28 October 2018 at 17:28 This comment has been removed by the author.
28 October 2018 at 17:53
Thanks for the information
For java interview programs visit: Java programming
17 January 2019 at 09:47
Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article. thank you for sharing such a great blog with us.Java Course In Hyderabad
9 May 2019 at 11:19
Learn java training in unic sol pvt ltd
I Found this article useful same as your. you can visit by clicking java training in Hyderabad
10 September 2019 at 12:23
Great post. Thanks for putting it out. For readers who are interested, LifePage has the most exhaustive Career List.
25 October 2019 at 12:28
Thanks for sharing valuable information in on aboutcyber security course.
15 February 2020 at 17:08
Excellent job, Positive thoughts, I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. Please keep posting and sharing.
Digital Marketing Company near me
31 March 2020 at 19:24
The thoughts while reading the article is amazing. Thanks for sharing this blog with us.
Deep tissue massage
16 April 2020 at 17:55
click here to read more
2 December 2020 at 16:56
Thank you for sharing this useful article with us. This blog is a very helpful to me in future. Keep sharing informative articles with us.
https://www.ahmedabadcomputereducation.com/course/laravel-training-course/
7 January 2021 at 18:11
Awesome content for reading as well as knowledge. Thank you for sharing this informative article with us.
https://www.sdsfin.in/about-us/
14 April 2021 at 17:58
Thank You for sharing this informative article.
https://web30india.com/
1 September 2021 at 08:17
Excellent effort to make this blog more wonderful and attractive.
data science course in malaysia
2 September 2021 at 13:17
Amazing post.Thanks for sharing.........
Best way to learn java programming for beginners
Best Way to Learn Java
12 October 2021 at 15:02
Thanks for sharing..
Job hiring in chennai.
12 October 2021 at 15:03
Thanks for sharing'
14 October 2021 at 17:10
This blog is so cool. I am learning Java Training online. This blogs helps me find out better understanding about salesforce training. Thank you for this blog!
3 March 2022 at 12:02
Android Mobile App Development in Ahmedabad
Web 3.0 India is the most trusted Web3 Blockchain Development and NFT Development Company in USA. We also provides ICO, STO development for cryptocurrency.
https://web30india.com/
30 March 2022 at 16:29
Java : Public Static Void Main(String Args[]) - Explanation.
~
Java Interview Questions >>>>> Download Now
>>>>> Download Full
Java : Public Static Void Main(String Args[]) - Explanation.
~
Java Interview Questions >>>>> Download LINK
>>>>> Download Now
Java : Public Static Void Main(String Args[]) - Explanation.
~
Java Interview Questions >>>>> Download Full
>>>>> Download LINK
26 July 2022 at 17:34
Thank you for this knowledgeable article.
Blockchain Development Company in Ahmedabad
Web3 Development Company
Mobile Application Development
29 September 2023 at 04:48
Ankara
Bolu
Sakarya
Mersin
Malatya
SHG7F1
20 October 2023 at 06:09
istanbul evden eve nakliyat
zonguldak evden eve nakliyat
adıyaman evden eve nakliyat
bilecik evden eve nakliyat
ankara evden eve nakliyat
Q7G
1 November 2023 at 17:15
hatay evden eve nakliyat
ısparta evden eve nakliyat
erzincan evden eve nakliyat
muğla evden eve nakliyat
karaman evden eve nakliyat
KR7
2 November 2023 at 06:25
muş evden eve nakliyat
çanakkale evden eve nakliyat
uşak evden eve nakliyat
ardahan evden eve nakliyat
eskişehir evden eve nakliyat
NDAGGW
13 November 2023 at 23:34
1E939
Muş Lojistik
Raca Coin Hangi Borsada
Bayburt Şehirler Arası Nakliyat
Eryaman Parke Ustası
Kırklareli Şehirler Arası Nakliyat
Bilecik Parça Eşya Taşıma
Muş Evden Eve Nakliyat
Hamster Coin Hangi Borsada
Çerkezköy Çilingir
14 November 2023 at 09:57
CB159
Zonguldak Şehir İçi Nakliyat
Kalıcı Makyaj
Kilis Şehir İçi Nakliyat
Kocaeli Parça Eşya Taşıma
Denizli Parça Eşya Taşıma
Diyarbakır Lojistik
Çerkezköy Fayans Ustası
Yalova Lojistik
Adana Evden Eve Nakliyat
17 November 2023 at 01:10
D2811
Batman Şehir İçi Nakliyat
Niğde Lojistik
Batıkent Fayans Ustası
Isparta Parça Eşya Taşıma
Tekirdağ Parça Eşya Taşıma
Bilecik Lojistik
Keçiören Parke Ustası
Çerkezköy Ekspertiz
Iğdır Evden Eve Nakliyat
1 December 2023 at 10:03
2C70D
binance komisyon indirimi
4 December 2023 at 22:00
EE13A
referanskodunedir.com.tr
10 December 2023 at 05:10
03A48
Bitcoin Mining Nasıl Yapılır
Binance Hangi Ülkenin
Bitcoin Madenciliği Nedir
Bitcoin Çıkarma
Bitcoin Nasıl Kazanılır
Gate io Borsası Güvenilir mi
Kripto Para Nasıl Çıkarılır
Binance Yaş Sınırı
Btcturk Borsası Güvenilir mi
5 January 2024 at 11:31
1D0D8
kırklareli canli sohbet bedava
istanbul görüntülü sohbet yabancı
sohbet uygulamaları
kırşehir yabancı canlı sohbet
ığdır yabancı görüntülü sohbet siteleri
Afyon Yabancı Görüntülü Sohbet
bolu telefonda kadınlarla sohbet
kırşehir canlı sohbet sitesi
maraş sesli sohbet sesli chat
5 January 2024 at 13:04
60025
eskişehir görüntülü sohbet siteleri ücretsiz
Çankırı Ücretsiz Sohbet Sitesi
sohbet odaları
ığdır görüntülü sohbet kızlarla
adana ücretsiz sohbet odaları
random görüntülü sohbet
niğde ücretsiz görüntülü sohbet uygulamaları
bayburt sohbet odaları
istanbul canlı görüntülü sohbet odaları
5 January 2024 at 13:05
980D2
sivas rastgele görüntülü sohbet ücretsiz
bartın görüntülü sohbet uygulamaları ücretsiz
kadınlarla rastgele sohbet
canlı görüntülü sohbet uygulamaları
Adana Rastgele Sohbet
urfa sohbet
hatay görüntülü sohbet canlı
tekirdağ mobil sohbet odaları
isparta canlı sohbet et
7 January 2024 at 00:26
86D5E
Likee App Beğeni Hilesi
Binance Hesap Açma
MEME Coin Hangi Borsada
Bitcoin Nasıl Üretilir
Binance Ne Zaman Kuruldu
Instagram Beğeni Hilesi
Arg Coin Hangi Borsada
Görüntülü Sohbet
Expanse Coin Hangi Borsada
18 February 2024 at 23:28
2572B
en eski kripto borsası
en düşük komisyonlu kripto borsası
binance ne demek
okex
paribu
bitcoin seans saatleri
en güvenilir kripto borsası
poloniex
canlı sohbet uygulamaları
24 February 2024 at 23:11
7DCA0
kripto para nasıl alınır
bitcoin nasıl oynanır
bitmex
vindax
canlı sohbet ucretsiz
paribu
probit
binance
bitcoin ne zaman yükselir
27 February 2024 at 06:58
3EF1D
bitcoin nasıl üretilir
mobil proxy 4g
canlı sohbet
https://toptansatinal.com/
ilk kripto borsası
kripto ne demek
kripto para telegram
referans kimligi nedir
bingx
14 August 2024 at 15:11
zxgdvdxfhgbfdhfthju
صيانة افران الغاز بجدة
11 October 2024 at 18:57
547EAD1329
ücretli şov sitesi
17 October 2024 at 17:29
تنظيف مجالس JWbf3Hj5Ig
6 November 2024 at 16:32
شركة مكافحة النمل الابيض 4YcSO2Jcq4
25 November 2024 at 11:05
981E12FCB6
show
8 December 2024 at 20:20
شركة تنظيف شقق بجازان Jp0KDdUa3w
30 December 2024 at 01:10
33775BC7BC
instagram düşmeyen takipçi
Post a Comment