I would suggest that you do:
if (status) {
//positive work
} else {
// negative work
}
The ==
tests, while obviously redundant, also run the risk of a single =
typo which would result in an assignment.
More Related Contents:
- Why is it considered a bad practice to omit curly braces? [closed]
- Is it ok if I omit curly braces in Java? [closed]
- .toArray(new MyClass[0]) or .toArray(new MyClass[myList.size()])?
- Java – when to use ‘this’ keyword [duplicate]
- Is it bad to explicitly compare against boolean constants e.g. if (b == false) in Java?
- for loop optimization
- Coding Conventions – Naming Enums
- What code folding plugins work on Eclipse 3.6?
- Stand-alone Java code formatter/beautifier/pretty printer? [closed]
- Should methods in a Java interface be declared with or without a public access modifier?
- Java Conventions: use getters/setters WITHIN the class?
- Conveniently map between enum and int / String
- Any reason to clean up unused imports in Java, other than reducing clutter?
- Use of the String(String) constructor in Java [duplicate]
- Is it good practice to use ordinal of enum?
- Java modifiers syntax and format
- Modifier Keyword order in Java
- Gracefully avoiding NullPointerException in Java
- For a boolean field, what is the naming convention for its getter/setter?
- Where should I put @Transactional annotation: at an interface definition or at an implementing class?
- Oracle Java code conventions
- Get rid of ugly if statements
- Is there a difference between main(String args[]) and main(String[] args)?
- Multiple or Single Try Catch [duplicate]
- Is concatenating with an empty string to do a string conversion really that bad?
- Should a collection of constants be placed in a class or interface?
- How can I convert a stack trace to a string?
- Incrementor logic
- How to increase the java heap size in netbeans?
- Google Sheet API V4(Java) append Date in cells