Shortest or longest

  • 10
  • Locked
Java games with lists are very popular. This makes sense, since they are all so simple and interesting. Join in the fun! In this task, we create a list of strings. Then we add 10 strings from the keyboard. The most interesting part is that we'll determine whether the shortest string or the longest string is encountered first in the list. If more than one string is shortest or longest, we'll consider the very first one we encounter.
You can't complete this task, because you're not signed in.
Comments(15)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Petros Yiannikouros Level 15 , Jacksonville
21 July, 18:52
I had to use the index.of method for arrays to get this correct.
EdddiegLevel 13 , Providence
21 June, 16:45
can someone please explain this question to me thank you
MoamalLevel 15 , Riyadh
14 July, 09:58
In this task , you are given many words and you have to determinate from the list whether the smallest or the biggest word came first and display it on the screen for example the words ( ground , in , on , yellow , grandmother , yellow ) the biggest : grandmother the smallest : in ,on since the smallest came first you should display it (only one word 'in' )
KatarinaLevel 8 , Kosice
7 February, 11:50
When you do this task after all previous in this lesson it is quite easy :)
Thomas SixberryLevel 16 , Rochester Hills
5 February, 04:56
Only 17 attempts.
Clarendon leeLevel 8 , Baltimore
17 January, 02:10
I think,this task makes some mistake! For example, I try several times, when I just use " if ( max== list.get(I).length())" it can output "grandfather " ! But when just use " if( min== list.get(I).length())" it can't output anything at all ! This task is wrong at all. ,!!!
AlexLevel 41
17 January, 07:23
Please submit a question with your code in the Help section.
DincaLevel 13 , Giurgiu
23 October 2019, 16:56
I compiled the code and the answer is correct why it does not pass the test?
RomanLevel 41
24 October 2019, 05:48
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.
AlexandrLevel 9 , Boryspil'
11 September 2019, 19:18
Please me help!:) Why does not pass the test???
RomanLevel 41
24 October 2019, 05:47
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.
KIN SOCHEATLevel 30 , Phnom Penh
29 May 2019, 03:27
my code some out correct but the result give wrong. Someone can help please
An GeloLevel 18 , Cebu
18 August 2018, 14:40
Hi can someone give me an example of the output. I'm having a hard time to analyze. thank you :)
RomanLevel 41
20 August 2018, 08:19
For example:
one1
two
three
four
five
six
seven
eight
nine
ten
the longest: three, seven, eight the shortest: two, six, ten You should display "two", because this string occurs earlier in the list from the shortest or the longest strings.
Rakesh KumarLevel 16 , Gambat
28 June 2019, 16:14
Thank you very much, this hint is very useful.