English
Summary
Conclusions
Type, range, input format, and termination condition together form the contract of a basic algorithm. Validation is needed beyond the point before arithmetic: an operation's result can also exceed the permitted bounds.
Self-check questions
- How does var differ from a dynamic type?
- Why does long not fix an int product that has already overflowed?
- When does type widening lose precision?
- How does integer division differ from floating-point division?
- How does short-circuit evaluation work?
- Why does hasNextInt not consume an invalid token?
- What remains after nextInt before nextLine?
- What is yield used for in a switch expression?
- What actions does continue perform in for?
- How can you prove that a loop terminates?