2 Operators are methods
In Scala, primitives are represented as objects. (Although after compilation they are using Java’s primitives when possible for performance).
Since they are objects, operators are simply method calls!
1 + 2 is simply calling a method named
+ on the object
1 + 2 is actually:
Scala has precedence for operator-like methods (that will be discussed later) to support correct arithmetic operations.
This notation is called “operator notation” or “infix notation” is not limited just to arithmetic operations, but this will be explained later.