This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 6661
    
    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: 19649
    
  18

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: 18504
    
  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)
 
Don't get me started about those stupid light bulbs.
 
subject: How to Call main() method another class from one class.
 
Similar Threads
main()
invoking classes
How to call another class when there is no source code?
Overloading wih static methods
How to call one class main method from another class main method