Blog Introductions
In this blog contains tutorials about HTML Tutorials, Python Tutorials, CSS Tutorials, How to, PHP Tutorials, Java Tutorials, C++ Tutorials, Tutorials, Examples, Source code,Learning,
Tips and Software development services. Java arithmatic and logical Operations | Java tutorials Bestitworriors
Java arithmatic and logical Operations
Java arithmatic and logical Operations | Java tutorials Bestitworriors - Java operation use to perform various function on data like addition , multiplication , subtraction , division , modulus, increment , decrement.By using these operation we perform various function on it.
Some Key Points of Java Operation
- + Addition Adds together two values x + y
- - Subtraction Subtracts one value from another x - y
- * Multiplication Multiplies two values x * y
- / Division Divides one value by another x / y
- % Modulus Returns the division remainder x % y
- ++ Increment Increases the value of a variable by 1 ++x
- -- Decrement Decreases the value of a variable by 1 --x
- == Equal to x == y
- != Not equal x != y
- > Greater than x > y
- < Less than x < y
- >= Greater than or equal to x >= y
- <= Less than or equal to x <= y
Code
public
class operatorss {
public static void main(String[] args) {
int var1 = 15;
int var2 = 10;
int add = var1 + var2;
int sub = var1 - var2;
int div = var1 / var2;
int mul = var1 * var2;
System.out.println("Addition of var1 and var2 ="+add);
System.out.println("Substraction of var1 and var2 ="+sub);
System.out.println("Division of var1 and var2"+div);
System.out.println("Multiplication of var1 and var2"+mul);
}
}
OutPut
Addition of var1 and var2 =25
Substraction of var1 and var2 =5
Division of var1 and var21
Multiplication of var1 and var2150
Substraction of var1 and var2 =5
Division of var1 and var21
Multiplication of var1 and var2150
0 Comments