File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Move implemenation out of main(String[ ] args)

 
Aretha Clark
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 624
IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 707
3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4660
5
Linux Mac OS X VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generally you want to create a constructor for Dvdinventory and a function, something like process().

In your main, do something like
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic