Operators constitute the basic building block to any programming language. Java too provides many types of operators which can be used according to the need to perform various calculations and functions, be it logical, arithmetic, relational, etc. They are classified based on the functionality they provide. Here are a few types:
This article explains all that one needs to know regarding Arithmetic Operators.
These operators involve the mathematical operators that can be used to perform various simple or advanced arithmetic operations on the primitive data types referred to as the operands. These operators consist of various unary and binary operators that can be applied on a single or two operands. Let’s look at the various operators that Java has to provide under the arithmetic operators.
Now let’s look at each one of the arithmetic operators in Java:
1. Addition(+): This operator is a binary operator and is used to add two operands.
Syntax:
num1 + num2
Example: