Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

calling two classes in the same program

 
Chris Fetterley
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to created a file i/o program that will ftp the information when the window closes. The information has to go to a different server hence why I want to do an ftp and not have the file placed somewhere on the network. The question is then does anyone have an idea as how to call the ftp class within the same program?
(2 main classes, one program)
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps I don't understand exactly what you are asking, but you should be able to do something like this:

Of course, these may not be the exact methods you need. I'm also assuming that you wrote the FTP class, but if the API already has one, you should use that instead. Check out the API docs to find what functionality it provides this way.
Also, it will help a lot if you can be more specific. You should post a small amount of code to illustrate what you are doing. This gives your question some context and we can work with it from there.
Layne
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once a JVM is running, a main method is just like any other method. You just have to prepare the parameters (if any) and call the method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic