How do I get a random item from a list in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I get a random item from a list in java?

If I did a ArrayList in java with a couple of words (Like "hello" "hey" "bye") and I wanted to make the computer take a random word from the list, how do I do that?

30th Aug 2019, 6:13 PM
Warrior422
Warrior422 - avatar
2 Answers
+ 1
Hello Warrior, I've just written a code for you. This is a solution. Check this out. :) https://code.sololearn.com/cOvO89YGjoMC/?ref=app
30th Aug 2019, 6:54 PM
Jakub ⚡
Jakub ⚡ - avatar
0
Thank you
8th Jan 2020, 2:03 AM
Warrior422
Warrior422 - avatar