0% found this document useful (0 votes)
0 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)
0 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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy