Ask coding questions

← Back to all posts
Question about -Random- variable in java
xMisbahx (20)

I have an arraylist in my program and I want it to print a random item from that list. I also want the same list to continue to print out items, but only if the user enters a specific command into the console. How do I do that?

(the letters are placeholders for now)


Answered by Coder100 (18882) [earned 5 cycles]
View Answer
Coder100 (18882)

that doesn't seem like a random question -- that seems like a scanner question
use the Scanner class to get user input, and then do