Operators in Java Programming
Operators in Java
In this lesson, we are going to look at what is an operator and will learn the names of different types of operators.
Definition of Operator
An operator in Java is a symbol that helps us to perform specific mathematical and logical computations on operands. In other words, we can say that an operator operates the operands.
Now let's see an example for more understanding.
int a=5, b=9, c; c=a+b;
Here, + is an operator known as the addition operator and variables a, b are operands. The addition operator tells the compiler to add the value of both the operands a and b and store the result in variable c. So the value of c will be 14.
Java has many built-in operator types, but the most important operator types are:
- Assignment Operators
- Arithmetic Operators
- Relational Operators
- Logical Operators
We will discuss all the operators in our upcoming lessons.