permaculture playing cards
The moose likes Beginning Java and the fly likes any one tell me? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "any one tell me?" Watch "any one tell me?" New topic

any one tell me?

manish kr. pandey

Joined: Aug 30, 2011
Posts: 14
the main method of java

public static void main(String x[])

in which class this method belong?
Matthew Brown

Joined: Apr 06, 2010
Posts: 4518

Welcome to The Ranch!

Quick answer: whichever class you want to start the program in.

That method isn't part of the standard Java libraries. It's a particular signature that the Java run-time will look for whenever you try to "execute" a class.
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11687

Some folks might say "all of them". You can write a project with hundreds of classes, and each and every one can have a main method.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Don't get me started about those stupid light bulbs.
subject: any one tell me?