Table of Contents
In this tutorial, we will discuss the concept of Operator in Java programming language
Many types of operators are available in java which are used to perform various operations.
Different types of java operators are given below
We can use arithmetic operators to perform the calculation to calculate the value in programs. Arithmetic operators +,-,*,/, and % perform addition,subtraction, multiplication and modulus.
Arithmetic operators can be applied on any numeric type.
addition of a+b :32 subtraction of a-b :8 multiplication of a*b :240 division od a/b :1 modulus of a/b :8
Value of a++ is :10 Value of a-- is :11 Value of ++a is :11 Value of --a is :10
The assignment operator is used to assign a value to the variable. We simply understand and assign the value on the right of the ‘Assignment operator‘ to the variable on the left.
Example
Value of a+=6 is :16 Value of a-=5 is :11 Value of a*=4 is :44 Value of a/=3 is :14 Value of a%=2 is :0
Java has six relational operators that compare two numbers and return only boolean value. Relational operators are <,>,==,<=,>= and != in Java.
The result of a==b = false The result of a!=b = true The result of a>b = false The result of a<b = true The result of a>=b = false The result of a<=b = true
The logical operator is used to compare multiple conditions and return the boolean value.
false true true false false false true
Multiply two numbers in Java using scanner| 5 different ways In this article, we will…
5 Different ways to Divide two numbers in Java using scanner In this article, we…
Learn 8 Ways to Subtract Two Numbers Using Methods in Java In this article, we…
10 ways to subtract two numbers in Java In this article, we will discuss the…
Java Code Examples – Multiply Two Numbers in 5 Easy Ways In this article, we…
How to Divide two numbers in Java| 5 different ways In this article, we will…
This website uses cookies.