Shazia Bashir wrote:thanks for the great answer. Im new to programming, could you please write some code in how i can do it ? thanks.
That's not usually how we do things. Try out something yourself, and come back if you have any problems.
ALSO: While Matthew's suggestion is definitely the most generic, you could just do a brute-force search of
Car.values() if you don't have very many; and the code to do that will be a lot simpler.
Winston