0% found this document useful (0 votes)
2 views2 pages

Java Operators Assignment Handwriting Style

The document provides an overview of various Java operators, categorized into arithmetic, bitwise, relational, boolean logical, assignment, and conditional operators. It includes examples and explanations for each operator type, as well as a section on operator precedence. The information is structured to aid understanding of how these operators function in Java programming.

Uploaded by

akashcjstorage
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)
2 views2 pages

Java Operators Assignment Handwriting Style

The document provides an overview of various Java operators, categorized into arithmetic, bitwise, relational, boolean logical, assignment, and conditional operators. It includes examples and explanations for each operator type, as well as a section on operator precedence. The information is structured to aid understanding of how these operators function in Java programming.

Uploaded by

akashcjstorage
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
You are on page 1/ 2

Java Operators Assignment

Java Operators Assignment

1. Arithmetic Operators:

+ Addition: 10 + 5 = 15

- Subtraction: 10 - 5 = 5

* Multiplication: 10 * 5 = 50

/ Division: 10 / 5 = 2

% Modulus: 10 % 3 = 1

++ Increment: a = 5; a++ -> 6

-- Decrement: a = 5; a-- -> 4

2. Bitwise Operators:

& AND: 5&3=1

| OR: 5|3=7

^ XOR: 5^3=6

~ NOT: ~5 = -6

<< Left Shift: 5 << 1 = 10

>> Right Shift: 5 >> 1 = 2

>>> Unsigned Right Shift: -1 >>> 1 = (positive int)

3. Relational Operators:

== Equal to: 5 == 5 -> true

!= Not equal: 5 != 3 -> true

> Greater than: 5 > 3 -> true

< Less than: 5 < 3 -> false

>= Greater/equal: 5 >= 5 -> true

<= Less/equal: 5 <= 6 -> true

4. Boolean Logical Operators:

&& AND: true && false -> false

|| OR: true || false -> true


Java Operators Assignment

! NOT: !true -> false

5. Assignment Operators:

= a=5

+= a += 3 -> a = a + 3

-= a -= 2 -> a = a - 2

*= a *= 4 -> a = a * 4

/ = a /= 2 -> a = a / 2

%= a %= 3 -> a = a % 3

6. Conditional (Ternary) Operator:

Syntax: condition ? true_val : false_val

Example: int a = 10; int b = (a > 0) ? 1 : -1;

7. Operator Precedence (High to Low):

() [] .

++ -- ~ !

*/%

+-

<< >> >>>

< <= > >=

== !=

&

&&

||

?:

= += -= *= /= %= etc.

Use parentheses to change default precedence.

You might also like