Sam Pauken wrote:Ok, is there any way you could help me get started? I have never done this before and beyond what I've written above, I'm not sure how to approach this.
Step #1 - loop through the list
Step #2 - call split
Step #3 - print out last name
Which of these steps are you having trouble with? What do you have so far?
The players' last names are: Bryce
You have for-each loop on temp (which is array of names - first name followed by last name)
You normally use for-each loop when you want to iterate all elements of Iterable
If you just want a particular element, you could simply access that element (you know the index)
I think it may worth to spend some minutes to read the java tutorial, especially collections
Sam Pauken wrote:Yes, I'd just like to print each last name to the console. If I can do this a completely different way if there's any easier way to do this. I do not need to do it the way I'm doing. Please let me know if there's any easier way to do this.
Sam, it's really difficult to help when you don't listen. I believe I already told you in your other thread that:
1. Code will NOT solve your problems for you. You have to think.
2. Trying out solutions at random won't work either. It'll just get you more frustrated.
Raymond has given you the best piece of advice you can get right now (and it would have been mine too) - READ THE TUTORIALS.
If you don't understand something, come back here telling us exactly what it is that you don't follow, and we'll try to help. But while you're just flailing around aimlessly, you will never succeed. Or if you do - by accident - you probably won't understand why you did.
The code you've just posted contains ALL the elements you need for a solution. Now you just need to put your thinking cap on.
When you say a different way, different from what? You have not attempted a solution to your problem of removing the first name from the output. Make an attempt (use the tutorials as a guide) and then post it here. At that point, others can guide you towards an alternative solution if necessary.