Home Java Operators

Operators

14 min read
0
0
61

There are 4 Operators in Java Programming

  1. Arithematic operators
  2. Logical operators
  3. Assignment operators
  4. Relational operators
  5. Incremental, Decremental operators

Arithematic Operators

+ Addition
Subtraction
* Multiplication
/ Division
% Modulus

Example 1

Output

56
44
8
2

Example 2

Output

x+y= 30
x-y= 10
x*y= 200
x/y= 2
x%y= 0

Example 3

Output

30
60
50
10
600
1

Logical Operators

&& And Operator
|| or Operator
! Not opertor

Example 1

Output

true
false
false
true
false
true
true
true
true

Example 2

Output

true
true
true
true
true
true
true
true
false

Assignment Operators

= Assignment
+= Assignment after addition
-= Assignment after substraction
*= Assignment after multiplication
/= Assignment after division
%= Assignment after mod

Increment,Decrement Operators

++ Increment Operator
Decrement Operator

Increment Operator

Example 1

Output

x= 5
y= 10
x= 6
y= 11

Output

x= 5 y= 10
x= 6 y= 10
x= 6 y= 12
x= 9 y= 13

Output

Age=29
Age=32

Decrement Operator

Output

x= 10 z= 20
x= 9 z= 19

Output

x= 10 z= 20
x= 9 z= 20
x= 7 z= 20
x= 4 z= 19

Relational Operators

!= not equlal to
is equal to
> greater than
< less than
>= greater than or equal to
<= less than or equal to
Output

false
true
false
true
false
true

Output

x= 11
y= 21
z= 11
d= 20

Output

x= 11
y= 11
z= 11
d= 10
x+y+z+d=45
x+y+z+d=47

Output

12,11, 10
12,12, 130
46

Output

false
false
false
false
false
false
false
false
false
true
true
true
true
true
true
false
false

Operator Precedence

Output

x>2

Output

x>250

Output

Your Grade is B

 

 

 

  • Product Discount Calculation Java Mysql

    This tutorial will teach you how to make a Inventory Management System in Java and Mysql s…
  • Inventory Management Servlet Jsp with Ajax

    This tutorial will teach you how to make a Inventory Management System in Servlet Jsp with…
  • Arrays

      Array Index always start with 0 position. Example 1 [crayon-62fc28e641774194275351/…
Load More Related Articles
  • Product Discount Calculation Java Mysql

    This tutorial will teach you how to make a Inventory Management System in Java and Mysql s…
  • Inventory Management Servlet Jsp with Ajax

    This tutorial will teach you how to make a Inventory Management System in Servlet Jsp with…
  • Arrays

      Array Index always start with 0 position. Example 1 [crayon-62fc28e641774194275351/…
Load More By admin
  • Product Discount Calculation Java Mysql

    This tutorial will teach you how to make a Inventory Management System in Java and Mysql s…
  • Arrays

      Array Index always start with 0 position. Example 1 [crayon-62fc28e641774194275351/…
  • Sales Profit Margin Calculation Java Mysql

    This tutorial will teach you how to make a Inventory Management System in Java mysql step …
Load More In Java

Leave a Reply

Your email address will not be published.

Check Also

Product Discount Calculation Java Mysql

This tutorial will teach you how to make a Inventory Management System in Java and Mysql s…