This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one 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
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 6588
    
    1

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 - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19214

Moving to the beginner forum.


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

Joined: Sep 28, 2004
Posts: 16680
    
  19

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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to Call main() method another class from one class.
 
Similar Threads
invoking classes
How to call one class main method from another class main method
main()
Overloading wih static methods
How to call another class when there is no source code?