Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Really new to Java, need help please

 
Tommy Mac
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
-Tom

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
Posts: 710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12147
31
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 code...like printing out the first string from the args array. do as little as possible each time you re-compile.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic