File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes main method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "main method" Watch "main method" New topic
Author

main method

jai gurudev
Greenhorn

Joined: May 28, 2004
Posts: 20
hi,

is it possible to call main() from another method,give some example

regards

jaigurudev
Petr Blahos
Ranch Hand

Joined: Apr 28, 2004
Posts: 131
Yes, it is possible.

P.


Get a better web browser:<br /><a href="http://www.mozilla.org/products/firefox/switch.html" target="_blank" rel="nofollow">http://www.mozilla.org/products/firefox/switch.html</a>
Kj Reddy
Ranch Hand

Joined: Sep 20, 2003
Posts: 1704
I guess MMM() method should be declared as static.

Regards
Jagdish
subhit chauhan
Ranch Hand

Joined: Jun 20, 2002
Posts: 40
MMM() is a constructor !!!
iyappan sankaran
Ranch Hand

Joined: Aug 11, 2003
Posts: 58
yes,we can.

class sample
{
static
{
call();
}
public static void call()
{
main(new String[]{"hello","world"});
}
public static void main(String args[])
{
System.out.println(args[0]);
System.out.println(args[1]);
}
}
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: main method