• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Really new to Java, need help please

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Ranch Hand
Posts: 710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic