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!
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.