Results 1 to 2 of 2
Like Tree3Likes
  • 3 Post By KevinWorkman

Thread: Hi guys! Noob question...

  1. #1
    moominboy is offline Member
    Join Date
    Sep 2011
    Rep Power

    Default Hi guys! Noob question...

    Hi all!

    I'm pretty much just starting out in Java and am a bit confused by a piece of homework I have. Would appreciate pointers as to where I can look.

    I have a .txt file containing 300 Greek heroes/gods etc. I need to search the strings for any name which has the first 3 letters, repeated after the prefix.

    The only 2 right answers are Phosphor and Tartarus.

    I've tried various different methods but if I try to select a substring (0,3) it tells me it's out of index range? I'm assuming that's because there is 1 name with 2 letters.

    I'm at a complete loss right now. And I don't even know what to search for in Google! lol!

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power

    Default Re: Hi guys! Noob question...

    Write a method that tests a single String for the condition you're checking. Get that working. Then write a different method that reads in a file and returns a List of Strings. Then call the first method with each String in that List.

    If you get stuck on the first method, write an SSCCE that demonstrates what you're doing.
    moominboy, sunde887 and Fubarable like this.
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

Similar Threads

  1. Probably Really Noob Question
    By bpx95 in forum New To Java
    Replies: 2
    Last Post: 05-16-2011, 01:44 AM
  2. Reallyy noob question
    By x2robbie2x in forum New To Java
    Replies: 3
    Last Post: 02-18-2010, 04:58 AM
  3. Noob button question.
    By dudejonne in forum Java Applets
    Replies: 4
    Last Post: 10-20-2009, 10:51 PM
  4. Question - I'm a noob!
    By Insaeno in forum New To Java
    Replies: 5
    Last Post: 08-04-2008, 03:20 AM
  5. Noob question- easy
    By mattonitto in forum New To Java
    Replies: 7
    Last Post: 06-13-2008, 12:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts