aspose file tools*
The moose likes Beginning Java and the fly likes main() doubts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "main() doubts" Watch "main() doubts" New topic
Author

main() doubts

Mahesh Barik
Greenhorn

Joined: Aug 14, 2006
Posts: 15
can anyone tell me to which to class main() belongs,as we know for each method there is a particular class.so main() as a method it should be under a class that would be predefined.

Thanks
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

It belongs to the class you want to execute. It can be any class.


[My Blog]
All roads lead to JavaRanch
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
This is predefinied by the JVM.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Mahesh Barik:
...so main() as a method it should be under a class that would be predefined...

A "main" method is not predefined for any particular class. It can be included in any class you decide to put it in. What is predefined is the way main (with the proper signature) is used as an entry point...

"A Java virtual machine starts execution by invoking the method main of some specified class..." (JLS - 12.1 Virtual Machine Start Up).
[ October 10, 2006: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: main() doubts
 
Similar Threads
How to call a stand alone class from WAS???
Marcus Green's Mock question
StringBuffer
public static void main(String agrs[])
Eclipse annoyance