aspose file tools*
The moose likes Beginning Java and the fly likes Move implemenation out of main(String[ ] args) 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 "Move implemenation out of main(String[ ] args)" Watch "Move implemenation out of main(String[ ] args)" New topic
Author

Move implemenation out of main(String[ ] args)

Aretha Clark
Greenhorn

Joined: Mar 07, 2008
Posts: 21
Im looking for some guidance as to how i would go about moving implemenation out of main(String[ ] args). I have tried to do this a few times and all i seem to do is mess up my code.

Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

Originally posted by Aretha Clark:
I have tried to do this a few times and all i seem to do is mess up my code.


Could you be more specific? How is it messing up your code? Are you getting compile time errors? Runtime errors/exceptions? Is it just not doing what you want it to do?

If you can post the code for what you have tried, and what errors you are getting, it'd be a little easier to assist you.
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 687
    
    1
What happens if you move all your code out of main() to a Constructor for the class and insert a call to that constructor in main()?
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Generally you want to create a constructor for Dvdinventory and a function, something like process().

In your main, do something like
 
 
subject: Move implemenation out of main(String[ ] args)