KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In an if statement in Java how can I check whether an object exists in a set of items. E.g. In this scenario i need to validate that the fruit will be an apple, orange or banana. if (fruitname in ["APPLE", "ORANGES", "GRAPES"]) { //Do something } It's a very trivial thing but I couldn't figure out a short and concise way to accomplish this.
Tags (comma-separated)
Save Edits
Cancel