8.3. Operators, Conditionals, Iteration
This section describes the basic arithmetic operators (+, -, *, and so forth), conditionals (if, and switch), and looping constructs (while, do, and for). Some languages such as C++ permit programmers to adopt built-in operators as a syntactic shorthand for user-defined classes. For example, a C++ programmer might write the following code to add two geometric points together:
Point p1(3,4), p2(1,3); // C++ constructor syntax p1 += p2; // To translate point p1 by p2
The Java programming language does not allow programmers to overload operators, a technique which some programmers find confusing when they try it with user-defined types. In such cases, method calls are used in the Java programming language ...