0% found this document useful (0 votes)
11 views5 pages

Java Arithmetic Operators Explained

The document provides an overview of Java operators, categorizing them into five types: Arithmetic, Assignment, Comparison, Logical, and Bitwise. It details Arithmetic Operators with descriptions and examples, including Addition, Subtraction, Multiplication, Division, Modulus, Increment, and Decrement. Additionally, it includes sample Java programs demonstrating the use of these operators.

Uploaded by

leelarani
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views5 pages

Java Arithmetic Operators Explained

The document provides an overview of Java operators, categorizing them into five types: Arithmetic, Assignment, Comparison, Logical, and Bitwise. It details Arithmetic Operators with descriptions and examples, including Addition, Subtraction, Multiplication, Division, Modulus, Increment, and Decrement. Additionally, it includes sample Java programs demonstrating the use of these operators.

Uploaded by

leelarani
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Java Operators

Java Operators

Operators perform operations on operands like variables or values.

In Java, there are five types of operators based on the type of operations they perform. They are

Arithmetic Operators
Assignment Operators
Comparison Operators
Logical Operators
Bitwise Operators

Arithmetic Operators

Java Arithmetic Operators perform mathematical arithmetic operations and return the result. Following are the
arithmetic operators supported in Java.

Operator Name Description

+ Addition Returns the sum of two operands.

– Subtraction Returns the difference of right operand from left operand.

* Multiplication Returns the product of left and right operand.

/ Division Returns the division of left operand with right operand.

% Modulus Division Returns the reminder when left operand is divided by right operand.

++ Increment Increments the operand by 1.

— Decrement Decrements the operand by 1

Addition

Java Program

public class OperatorExample {


public static void main(String[] args) {
int a = 8;
int b = 3;
int c = a + b;
[Link](c);
}
}

Output

More about Java Addition Operator.

Subtraction

Java Program

public class OperatorExample {


public static void main(String[] args) {
int a = 8;
int b = 3;

int c = a - b;
[Link](c);
}
}

Output

More about Java Subtraction Operator.

Multiplication

Java Program

public class OperatorExample {


public static void main(String[] args) {
int a = 8;
int b = 3;

int c = a * b;
[Link](c);
}
}

Output
More about Java Multiplication Operator.

Division

Java Program

public class OperatorExample {


public static void main(String[] args) {
int a = 8;
int b = 3;

int c = a / b;
[Link](c);
}
}

Output

More about Java Division Operator.

Modulus Division

Java Program

public class OperatorExample {


public static void main(String[] args) {
int a = 8;
int b = 3;

int c = a % b;
[Link](c);
}
}

Output

More about Java Modulus Operator.

Increment

Java Program
Java Program

public class OperatorExample {


public static void main(String[] args) {
int a = 8;

int c = ++a;
[Link](c);
}
}

Output

More about Java Increment Operator.

Decrement

Java Program

public class OperatorExample {


public static void main(String[] args) {
int a = 8;

int c = --a;
[Link](c);
}
}

Output

More about Java Decrement Operator.

Java Tutorial

✦ Java Tutorial

✦ Java Introduction

✦ Java Installation

✦ IDEs for Java Development

✦ Java HelloWorld Program

✦ Java Program Structure


✦ Java Datatypes

✦ Java Variable Types

✦ Java Access Modifiers

➩ Java Operators

✦ Java Decision Making

✦ Java Loops

✦ Java Array

✦ Java OOPs

✦ Java String

✦ Java Exception Handling

✦ Java File Operations

✦ Java Date & Time

✦ Java MySQL

✦ Java Random

✦ Java Math

You might also like