This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Really new to Java, need help please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Really new to Java, need help please" Watch "Really new to Java, need help please" New topic

Really new to Java, need help please

Tommy Mac

Joined: Jan 19, 2010
Posts: 1
Hi guys,

I have absolutely no experience in Java and am being thrown into the fire right now. I was hoping someone could be so kind as to help me write a method so I can learn from it and extrapolate. My task is basically as follows, and I really appreciate any and all help.

Thanks so much,

I have to write a main method that reads in a set of strings from the command line, determines how many strings from the command line match the first string from the command line, and then prints out the first string entered at the command line and the number of times it was repeated in the set of strings entered at the command line.

W. Joe Smith
Ranch Hand

Joined: Feb 10, 2009
Posts: 710
First off, welcome to JavaRanch!

Secondly, we have a couple policies that we follow. One is DoYourOwnHomework. This sounds supsiciously like a homework question. A couple more policies are ShowSomeEffort and NotACodeMill. We are more than happy to help, we just won't do the work for you.

Here are my recommendations:
1. Break down your problem into small parts, and work out by hand in plain English how to accomplish this task.
2. Read the Java Tutorial on Sun's site, and do some googling to find out the basics of reading from the command line, looping, and printing in Java.

When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11923

the most important thing is to write your code in as small a chunk as you can before you compile, test, and debug. It is an extremely iterative process. Your first iteration should be something like this:

Once you test and debug this, you can take out that println statement, and put in more printing out the first string from the args array. do as little as possible each time you re-compile.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
marc weber

Joined: Aug 31, 2004
Posts: 11343

Tommy Mac wrote:... I was hoping someone could be so kind as to help me write a method so I can learn from it...

Sure! But the best way to learn is by doing. So show us what you have so far and where you're stuck, and we can probably help you.

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
subject: Really new to Java, need help please
It's not a secret anymore!