Let's create a list of strings, entering them from the keyboard until you get bored. You might get bored at any moment, and we need to come up with a special word to signal this. Let's use the word "end". And why do we need these strings, you ask? And we answer: So we can add them to a list, and then display them.
The end
- 5
Locked
Comments (7)
- Popular
- New
- Old
You must be signed in to leave a comment
LT
15 July 2021, 22:50
Use break keyword.
0
Rebekah H
10 August 2020, 10:43
Do we always use .equals() rather than == when testing a String? I can not recall having done this but may I've just not tested any awful lot of Strings?
0
Karas Java Developer
7 September 2020, 22:56
It is more precise, ther are some explanations in the useful links from the Dr in past lessons.
Hope you still can check them out.
Usually when checking Strings it is far better to use .equals, also with objects definitelly use .equals.
If they are ints is fine to use normal comparators.
It has to do with the memory of the computer and the refference where they are stored, numbers being simpler are stored differently.
0
Devonte A
2 June 2020, 14:16
I set a random limit e.g. 15 for the loop just to satisfy the condition and it worked, not sure if its the best solution doe :)
0
chinna gnanesh
26 November 2019, 05:42
output doesn't produce anything I think while loop runs continuously
0
Grigore Turcan
4 January 2019, 17:30
need some help :)
0
Roman
8 January 2019, 06:28
If you need help, something isn't right in your code, the server won't accept your solution (even if you are 100% sure that it is correct). Describe your question/issue in the HELP section at codegym.cc/help.
0