wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes How to Call main() method another class from one class. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to Call main() method another class from one class." Watch "How to Call main() method another class from one class." New topic
Author

How to Call main() method another class from one class.

Amol Pingate
Greenhorn

Joined: Oct 02, 2008
Posts: 14
can any one tell me how to call main() of One class from another class
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

AnotherClass.main() assuming main() is public static. This post needs to be in Java in General (Beginner)


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

Moving to the beginner forum.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

And assuming this main() method is the method that can be called from the command line, you also need to create a string array, as that methods takes a string array -- and fill in the params of course.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Call main() method another class from one class.