KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Let's take a simple example of an object Cat . I want to be sure the "not null" cat is either orange or grey. if(cat != null && cat.getColor() == "orange" || cat.getColor() == "grey") { //do stuff } I believe AND comes first, then the OR. I'm kinda fuzzy though, so here are my questions: Can someone walk me through this statement so I'm sure I get what happens? Also, what happens if I add parentheses; does that change the order of operations? Will my order of operations change from language to language?
Tags (comma-separated)
Save Edits
Cancel