I have an ArrayList containing Movies.
ArrayList<Movie>movies = new ArrayList<Movie>();
Movie has a property int movienumber
.
The user can select a movie according to the movienumber, by entering the desired number into the console.
I store the users choice inside a field moviechoice
.
How can I store the user-selected movie in the field Movie moviechosen
, according to the users input?
Meaning, how can I check if the users input matches the number property of a certain Movie
, and then store this Movie-object in the moviechoice
field?