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 .

Recommended Answers

All 2 Replies

first try! and show :) c'mon u can!

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.