jQuery in Action, 3rd edition
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
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: 4543

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: 11955

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
I agree. Here's the link: http://aspose.com/file-tools
subject: any one tell me?
It's not a secret anymore!