Results 1 to 2 of 2
- 09-26-2011, 04:36 PM #1Member
- Join Date
- Sep 2011
- Rep Power
Hi guys! Noob question...
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!
- 09-26-2011, 04:43 PM #2
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.
- By bpx95 in forum New To JavaReplies: 2Last Post: 05-16-2011, 01:44 AM
- By x2robbie2x in forum New To JavaReplies: 3Last Post: 02-18-2010, 04:58 AM
- By dudejonne in forum Java AppletsReplies: 4Last Post: 10-20-2009, 10:51 PM
- By Insaeno in forum New To JavaReplies: 5Last Post: 08-04-2008, 03:20 AM
- By mattonitto in forum New To JavaReplies: 7Last Post: 06-13-2008, 12:26 AM