Arithmetic Expressions in Java

Arithmetic Expressions in Java:

We can use the Eclipse IDE for this example. If you do not know about it then follow this link- How to Install Eclipse For Java and create a program in it.

Arithmetic Expressions in Java are used to perform arithmetic calculations. It consists of a series of operands separated by operators. An operand is the values, variables, numbers, or different quantities. Operators are arithmetic symbols i.e. addition (+), subtraction (-), multiplication (*), division ( \), and modulus (%). The modulus operator is used to find the remainder in the division.

  • Addition ( + ) Operator:
Addition Operator Java
  • Subtraction ( – ) Operator:
Subtraction Operator Java
  • Multiplication ( * ) Operator:
Multiplication Operator Java
  • Division ( / ) Operator:
division operator in java
  • Modulus ( % ) Operator:
Modulus Operator Java
  • Increment Operator ( ++ ):
increment operator java
  • Decrement Operator ( — ):
Decrement Operator Java

Note: When the two operands are integers and division is performed, the results are sometimes surprising. That is because the division of two integers always produces an integer result that is truncated and not rounded as shown below.

division in java

If we need a decimal value then we use double data type in java as shown below.

double data type in java

Tutorial MySQL
Tutorial Python
Computer Memory
Basic Components of Computer System
Computer Software and Hardware
Computer Input Devices
Computer Output Devices
Secondary Storage Devices
Characteristics of Computer
Java (programming language)– Wikipedia

Comments (No)

Leave a Reply