2 Expressions
This chapter covers
- Precedence-related errors
- Common mistakes stemming from one operator being used instead of another
- Pitfalls when using a conditional expression
- Common problems when using method calls and method references
This chapter discusses common bugs localized inside the single Java expression, such as using an incorrect operator or assuming the wrong operator precedence. Such bugs may result in an unexpected value being produced by the expression. I will also briefly discuss the bugs caused by the expression value being calculated correctly but ignored.
This chapter does not cover bugs related to specific data types, like numbers, strings, or collections. These are covered in subsequent chapters.
2.1 Mistake ...
Get 100 Java Mistakes and How to Avoid Them now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.