Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regarding the static

 
narayana satish
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a new person to Java. Why we are using static in the main function.Is it necessary,if so why.If not why...
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Defining a function as static means the function can execute without an instance of the class being created. This is why main is declared as static. It is where execution of a program begins, and it should execute even if no instances of the class are created.

Bosun
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic