Week 3 Exercise 57

200 views
Skip to first unread message

jsedm...@gmail.com

unread,
Jan 4, 2017, 11:16:59 PM1/4/17
to mooc.fi
Hi,

I'm having problems with week exercise 57  on course the for-each loop.

An array list is created called words.  The while loop starts and prints for the user to input a word.  Then it reads the string and adds the word to the array list.  The if statement starts and if the user does not input data, it prints out a line and should tell the user the inputted data.  After the data has printed it breaks.  Meanwhile the for loop is running but since String word is already defined, i'm getting an error.  Not sure what i am doing wrong.


Best regards

Jake

Wojciech Sadrak

unread,
Jan 6, 2017, 5:12:43 PM1/6/17
to mooc.fi, jsedm...@gmail.com
Hi Jake!

Show your code in another way, because I don't have access to your work. I think I can help you, because I've done this exercise few hours ago ;)

jsedm...@gmail.com

unread,
Jan 7, 2017, 12:21:14 AM1/7/17
to mooc.fi, jsedm...@gmail.com
I figured it out!  Had my for loop in while bracket.
Reply all
Reply to author
Forward
0 new messages