In Java, the predefined symbols or keywords that are used to perform operations on variables and values are referred to as operators. Java is full-filled with rich operators which can perform actions such as arithmetic calculations, comparisons, logical evaluations, and many more. Broadly speaking, the operators are classified into different types in Java.

What is relational operator in java javatpoint
The most commonly used ones are Arithmetic Operators which are used for the following basic functionality:
Addition, Subtraction, Multiplication, and Division and Modulus (remainder).
Here is an overview of the Arithmetic Operators:

Example of the Arithmetic Operators in java
int a = 10;
int b = 5;
System.out.println(a + b); // Output: 15
System.out.println(a - b); // Output: 5
Relational (Comparison) Operators in java
Used to compare two values or expressions, which give boolean value of true or false.

Example of Relational (Comparison) Operators in java
int a = 10;
int b = 5;
System.out.println(a > b); // Output: true
System.out.println(a == b); // Output: false
Logical Operators in java
Use logical operators for combining two or more boolean expressions and for performing the logical operation.

Example of Logical Operators in java
boolean a = true;
boolean b = false;
System.out.println(a && b); // Output: false
System.out.println(a || b); // Output: true
Assignment Operators in Java
Assignment is the process of assigning values to variables. The major assignment operator is =. Moreover, assignment and other operations can be combined in the following compound assignment operators:

Example of Assignment Operators in java
int a = 10;
a += 5; // a = a + 5 -> a = 15
System.out.println(a); // Output: 15
Unary Operators in java
They only use unary operators and can only operate on one operand. They are mainly for incrementing or decrementing a variable or to apply negation.

Example of Unary Operators in java
int a = 10;
System.out.println(a++); // Output: 10 (post-increment)
System.out.println(++a); // Output: 12 (pre-increment)
Bitwise Operators in java 2025 with example
Bitwise operators can perform bit-level operations on integer values (normally, the use with int and long).

example of Bitwise Operators in java
int a = 5; // In binary: 0101
int b = 3; // In binary: 0011
System.out.println(a & b); // Output: 1 (binary: 0001)
System.out.println(a | b); // Output: 7 (binary: 0111)
Ternary (Conditional) Operator in java
The ternary operator simply provides a more concise promissory note of the if-else statement. It works with three operands.

Example of Ternary (Conditional) Operator
int a = 10, b = 20;
int result = (a > b) ? a : b; // result = b (since 10 is not greater than 20)
System.out.println(result); // Output: 20
Instanceof Operator in java
This operator is used to test when an object is an instance of a specific class or subclass.

Example of Instanceof Operator.
String str = "Hello";
System.out.println(str instanceof String); // Output: true
Type Casting Operators in java
These are used to convert one type of data into another. Implicit and explicit casting is supported in Java.
Implicit and automatic casting occurs when a lesser type is converted into a greater type. If a greater type is converted into a lesser type, it is called explicit or manual casting.
int a = 10;
double b = a; // Implicit casting (int to double)
double c = 5.5;
int d = (int) c; // Explicit casting (double to int)
Lambda Operator in Java (Java 8 onwards) with example 2025
The lambda operator -> is being used in Java 8 and in all succeeding versions to define lambda expressions, which provide ways to pass functionality as arguments to the methods.
List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5);
numbers.forEach(n -> System.out.println(n)); // Lambda expression
java operators
Operators in Java are good for performing various operations on data. They are quite essential to manipulating variables, carrying operation control in a program, and doing computations. Knowing how these operators can be used is crucial in writing efficient and functional Java code.
Pingback: Java Tutorial For Beginners an easy Approach - Javatpoint