File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Using Main Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Using Main" Watch "Using Main" New topic

Using Main

Benjamin Thomas

Joined: May 16, 2011
Posts: 1
I am a Java beginner struggling with the transition to OO programming. Or, at least I think that's why I am struggling. I worked my way through a few Java books and not much stuck. Now I am working my way through an old Python book, but forcing myself to accomplish all of the tasks using Java instead of Python. The hope is that this will force me to work through problems and ask questions rather than simply copying code from the book. Anyway, my problem is as follows. I need to accomplish a few very simple tasks. I need to read a list of comma-delimited times in from a file, format the times, remove duplicates, and print the three fastest times. Oddly enough, I think that I have a pretty good handle on the methods required to make this happen. I'm just at a loss as to how to call any methods after the first one. This is what I have:

As you can guess, this code performs the first method ( loadFile ) perfectly and I print all of the times twice; first as they appear in the file and second after they have been cleaned up. What I cannot grasp is how to get the returned String normTimes into the second method doTree, or how to call that second method. I know this is probably a fairly stupid problem to have and I fear that I am in the odd spot of understanding some more complex parts of Java while not understanding the very simple ones. Anyway, any advice would be appreciated. Advice with explanations would be extremely helpful.

Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2452
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46368
And welcome to the Ranch
I agree. Here's the link:
subject: Using Main
It's not a secret anymore!