Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

please help to explain  RSS feed

 
catherine matthews
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public static void main (String args[])

what is the meaning of static here? why it is static?
And i think each program must havwe atleast 1 main method to be executed..
but what is the meaning of String args[]?

Please help
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by catherine matthews:
public static void main (String args[])

what is the meaning of static here? why it is static?
And i think each program must havwe atleast 1 main method to be executed..
but what is the meaning of String args[]?

Please help


Well I think you are a newbie to JAVA Technologies.

1. what is the meaning of static here? why it is static?

Answer: static mean that you can call this method directly with refernce of Class.

What happens is during the run time. JVM may call your program by java ClassName

So that implicitly means you are calling ClassName.main(String arg[]) method. Which is meant as starting point in JAVA to run your application (except Applets). Hope this clear your doubts


but what is the meaning of String args[]?


This is used for giving command line arguments.

I think you know about command line arguments. If not then check the following link

Command Line Arguments

also check this one.

What is the meaning of Command Line arguments
Hope it helps you.
[ August 24, 2006: Message edited by: Ankur Sharma ]
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!