In SQL there is an IN statement that looks for a value within a given list. Example.
SELECT town
FROM tblTowns
WHERE town IN (‘Johannesburg’, ‘Pretoria’, ‘Cape Town’);
How does one code the same thing in Java when using a regular array?
Here is a two-class OOP approach. It passes an array as a parameter and searches for the given value within the array. It breaks out of the code block if the value is found to avoid redundancy