Overview
In this tutorial, we will learn about Java arithmetic expressions. A Java expression is a combination of operands, operators, constants, and function calls that reduces to a value.
Types of Arithmetic Expressions
- Integer Expressions
- Floating point expressions
- Mixed mode expressions
Integer expressions
When all the operands in the expression are of integer types such an expression is called an integer expression.
For example:
int x = 10;
int y = 12;
int result;
result = x + y;
Floating-point expressions
When all the operands in the expression are of a real type such as float/double types such an expression is called a floating-point expression.
For example:
float x = 10.5;
float y = 12.63;
float result;
result = x + y;
Mixed mode expressions
When some operands in the expression are integer and others of a real type such as float/double types such an expression is called a mixed mode expression.
For example:
float x = 12.55;
int y = 10;
float result;
result = x + y;
—
Java Tutorials
Java Tutorial on this website:
https://www.testingdocs.com/java-tutorial/
For more information on Java, visit the official website :