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

explanation for static  RSS feed

 
ashok r
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pls help me in understanding the usuage of the key word "static" in public static void main(String arg[])
 
Joe Ess
Bartender
Posts: 9428
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the Java Tutorial, particularly the page describing Instance and Class variables. Since this has nothing to do with IO in particular, I'm going to move it to Java In General Beginner
[ September 20, 2005: Message edited by: Joe Ess ]
 
Robert Watkins
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The simple answer is that the static method is associated with the class definition, while non-static methods are associated with _instances_ of the class.

The more complex answer is that static methods are instance methods on the instance of Class represented by the class definition.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!