Here is problem:

I ask user for how many dogs do you have

user enter 5

i go via for loop and add the name into arraylist and now i want to display like

  1. Java
  2. is
  3. fun
    and so more.... not just 3

after I want to ask user which dog do you want to perform the action

let say user i want to "fun" to perform those action

I was thinking about case loop but if i set to 3 case what if the user enter more than 3?

how can or what best way to do it .

3 Years
Discussion Span
Last Post by Shark_1

Do a Loop between LowerBound and UpperBound of the ArrayList. In loop Check the condition like ArrayList(i)=UserInput. If the condition satisfy Exit from Loop.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.