SlideShare a Scribd company logo
Prepared by: Assi. Professor Sejal Jadav
JAVA Operators
Java provides a rich set of operators to manipulate variables.
We can divide all the Java operators into the following groups:
1. Arithmetic Operators
2. Relational Operators
3. Bitwise Operators
4. Logical Operators
5. Assignment Operators
The Arithmetic Operators:
• Arithmetic operators are used in mathematical expressions.
• The following table lists the arithmetic operators:
• Assume integer variable A holds 10 and variable B holds 20,
then:
• int a=10;
• int b=20;
Operat
or
Description Example
+
Addition - Adds values on either side of the
operator
A + B will
give 30
-
Subtraction - Subtracts right hand operand
from left hand operand
A - B will
give -10
*
Multiplication - Multiplies values on either
side of the operator
A * B will
give 200
/
Division - Divides left hand operand by
right hand operand
B / A will
give 2
%
Modulus - Divides left hand operand by
right hand operand and returns remainder
B % A will
give 0
The Relational Operators:
• There are following relational operators supported by Java
language
• Assume variable A holds 10 and variable B holds 20, then:
• Int a=10;
• Int b=20;
Operato
r
Description Example
==
Checks if the values of two operands are equal or
not, if yes then condition becomes true.
(A == B) is not
true.
!=
Checks if the values of two operands are equal or
not, if values are not equal then condition
becomes true.
(A != B) is
true.
>
Checks if the value of left operand is greater than
the value of right operand, if yes then condition
becomes true.
(A > B) is not
true.
<
Checks if the value of left operand is less than the
value of right operand, if yes then condition
becomes true.
(A < B) is true.
>=
Checks if the value of left operand is greater than
or equal to the value of right operand, if yes then
condition becomes true.
(A >= B) is not
true.
<=
Checks if the value of left operand is less than or
equal to the value of right operand, if yes then
condition becomes true.
(A <= B) is
true.
The Logical Operators:
The following table lists the logical operators:
Assume Boolean variables x holds true and variable y holds false, then:
Int A=10, b=10;
X= (A==b) true
Int c=10,d=20;
Y=(c==d)  false
Opera
tor
Description Example
&&
Called Logical AND operator. If both the
operands are true then the condition
becomes true.
(A && B)
is false.
||
Called Logical OR Operator. If any of the two
operands are true then the condition
becomes true.
(A || B) is
true.
!
Called Logical NOT Operator. Use to reverses
the logical state of its operand. If a condition
is true then Logical NOT operator will make
false.
!(A && B)
is true.
The Assignment Operators:
• There are following assignment operators supported by Java language:
Operat
or
Description Example
=
Simple assignment operator,
Assigns values from right side
operands to left side operand
C = A + B will assign value of
A + B into C
+=
Add AND assignment operator, It
adds right operand to the left
operand and assign the result to left
operand
C += A is equivalent to
C = C + A
-=
Subtract AND assignment operator,
It subtracts right operand from the
left operand and assign the result to
left operand
C -= A is equivalent to
C = C - A
*=
Multiply AND assignment operator,
It multiplies right operand with the
left operand and assign the result to
left operand
C *= A is equivalent to
C = C * A
/=
Divide AND assignment operator, It
divides left operand with the right
operand and assign the result to left
operand
C /= A is equivalent to
C = C / A
Operator Description
+ Unary plus operator; indicates positive value
(numbers are positive without this, however)
- Unary minus operator; negates an expression
++ Increment operator; increments a value by 1
-- Decrement operator; decrements a value by 1
! Logical complement operator; inverts the value of a
boolean
The Unary Operators
• The unary operators require only one operand;
they perform various operations
• such as incrementing/decrementing a value by one, negating an expression,
• or inverting the value of a boolean.
 java operators

More Related Content

What's hot

Operators and it's type
Operators and it's type Operators and it's type
Operators and it's type
Asheesh kushwaha
 
Operators
OperatorsOperators
Opreator In "C"
Opreator In "C"Opreator In "C"
Opreator In "C"
Amlendu dubey
 
Python operators part2
Python operators part2Python operators part2
Python operators part2
Vishal Dutt
 
Operators in C & C++ Language
Operators in C & C++ LanguageOperators in C & C++ Language
Operators in C & C++ Language
PreSolutions Softwares
 
Chapter 5 - Operators in C++
Chapter 5 - Operators in C++Chapter 5 - Operators in C++
Chapter 5 - Operators in C++Deepak Singh
 
Operators in C/C++
Operators in C/C++Operators in C/C++
Operators in C/C++
Shobi P P
 
Operator 04 (js)
Operator 04 (js)Operator 04 (js)
Operator 04 (js)
AbhishekMondal42
 
Logical Operators C/C++ language Programming
Logical Operators C/C++ language ProgrammingLogical Operators C/C++ language Programming
Logical Operators C/C++ language Programming
Nawab Developers
 
Operator.ppt
Operator.pptOperator.ppt
Operator.ppt
Darshan Patel
 
Operators and Expressions in Java
Operators and Expressions in JavaOperators and Expressions in Java
Operators and Expressions in JavaAbhilash Nair
 
Bit shift operators
Bit shift operatorsBit shift operators
Bit shift operators
alldesign
 
Operators and expressions
Operators and expressionsOperators and expressions
Operators and expressionsvishaljot_kaur
 
CBSE Class XI :- Operators in C++
CBSE Class XI :- Operators in C++CBSE Class XI :- Operators in C++
CBSE Class XI :- Operators in C++Pranav Ghildiyal
 
Operation and expression in c++
Operation and expression in c++Operation and expression in c++
Operation and expression in c++
Online
 
2. operators in c
2. operators in c2. operators in c
2. operators in c
amar kakde
 
Operator in c programming
Operator in c programmingOperator in c programming
Operator in c programming
Manoj Tyagi
 
Basic c operators
Basic c operatorsBasic c operators
Basic c operatorsdishti7
 

What's hot (20)

Operators and it's type
Operators and it's type Operators and it's type
Operators and it's type
 
Operators
OperatorsOperators
Operators
 
Opreator In "C"
Opreator In "C"Opreator In "C"
Opreator In "C"
 
Python operators part2
Python operators part2Python operators part2
Python operators part2
 
Operators in C & C++ Language
Operators in C & C++ LanguageOperators in C & C++ Language
Operators in C & C++ Language
 
Chapter 5 - Operators in C++
Chapter 5 - Operators in C++Chapter 5 - Operators in C++
Chapter 5 - Operators in C++
 
Operators in C/C++
Operators in C/C++Operators in C/C++
Operators in C/C++
 
Operator 04 (js)
Operator 04 (js)Operator 04 (js)
Operator 04 (js)
 
Logical Operators C/C++ language Programming
Logical Operators C/C++ language ProgrammingLogical Operators C/C++ language Programming
Logical Operators C/C++ language Programming
 
Operator.ppt
Operator.pptOperator.ppt
Operator.ppt
 
Operators and Expressions in Java
Operators and Expressions in JavaOperators and Expressions in Java
Operators and Expressions in Java
 
Bit shift operators
Bit shift operatorsBit shift operators
Bit shift operators
 
Operators and expressions
Operators and expressionsOperators and expressions
Operators and expressions
 
Report on c
Report on cReport on c
Report on c
 
CBSE Class XI :- Operators in C++
CBSE Class XI :- Operators in C++CBSE Class XI :- Operators in C++
CBSE Class XI :- Operators in C++
 
Operation and expression in c++
Operation and expression in c++Operation and expression in c++
Operation and expression in c++
 
2. operators in c
2. operators in c2. operators in c
2. operators in c
 
Operator in c programming
Operator in c programmingOperator in c programming
Operator in c programming
 
Java basic operators
Java basic operatorsJava basic operators
Java basic operators
 
Basic c operators
Basic c operatorsBasic c operators
Basic c operators
 

Similar to java operators

itft-Operators in java
itft-Operators in javaitft-Operators in java
itft-Operators in java
Atul Sehdev
 
Java basic operators
Java basic operatorsJava basic operators
Java basic operators
Emmanuel Alimpolos
 
Opeartor &amp; expression
Opeartor &amp; expressionOpeartor &amp; expression
Opeartor &amp; expression
V.V.Vanniapermal College for Women
 
Operators in Python
Operators in PythonOperators in Python
Operators in Python
Anusuya123
 
Constructor and destructors
Constructor and destructorsConstructor and destructors
Constructor and destructors
divyalakshmi77
 
Java unit1 b- Java Operators to Methods
Java  unit1 b- Java Operators to MethodsJava  unit1 b- Java Operators to Methods
Java unit1 b- Java Operators to Methods
SivaSankari36
 
Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++
Himanshu Kaushik
 
python operators.ppt
python operators.pptpython operators.ppt
python operators.ppt
ErnieAcuna
 
C operators
C operatorsC operators
C operators
Rupanshi rawat
 
Operators used in vb.net
Operators used in vb.netOperators used in vb.net
Operators used in vb.net
Jaya Kumari
 
Fundamentals of Programming Chapter 5
Fundamentals of Programming Chapter 5Fundamentals of Programming Chapter 5
Fundamentals of Programming Chapter 5
Mohd Harris Ahmad Jaal
 
Computer programming 2 Lesson 7
Computer programming 2  Lesson 7Computer programming 2  Lesson 7
Computer programming 2 Lesson 7
MLG College of Learning, Inc
 
Conditional and special operators
Conditional and special operatorsConditional and special operators
Conditional and special operators
Megha Sharma
 
Py-Slides-2.ppt
Py-Slides-2.pptPy-Slides-2.ppt
Py-Slides-2.ppt
AllanGuevarra1
 
Py-Slides-2 (1).ppt
Py-Slides-2 (1).pptPy-Slides-2 (1).ppt
Py-Slides-2 (1).ppt
KalaiVani395886
 
Py-Slides-2.ppt
Py-Slides-2.pptPy-Slides-2.ppt
Py-Slides-2.ppt
TejaValmiki
 
Python operators
Python operatorsPython operators
Python operators
nuripatidar
 
COM1407: C Operators
COM1407: C OperatorsCOM1407: C Operators
COM1407: C Operators
Hemantha Kulathilake
 

Similar to java operators (20)

itft-Operators in java
itft-Operators in javaitft-Operators in java
itft-Operators in java
 
Java basic operators
Java basic operatorsJava basic operators
Java basic operators
 
Opeartor &amp; expression
Opeartor &amp; expressionOpeartor &amp; expression
Opeartor &amp; expression
 
07 ruby operators
07 ruby operators07 ruby operators
07 ruby operators
 
Operators in Python
Operators in PythonOperators in Python
Operators in Python
 
Constructor and destructors
Constructor and destructorsConstructor and destructors
Constructor and destructors
 
Java unit1 b- Java Operators to Methods
Java  unit1 b- Java Operators to MethodsJava  unit1 b- Java Operators to Methods
Java unit1 b- Java Operators to Methods
 
Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++
 
Java script session 4
Java script session 4Java script session 4
Java script session 4
 
python operators.ppt
python operators.pptpython operators.ppt
python operators.ppt
 
C operators
C operatorsC operators
C operators
 
Operators used in vb.net
Operators used in vb.netOperators used in vb.net
Operators used in vb.net
 
Fundamentals of Programming Chapter 5
Fundamentals of Programming Chapter 5Fundamentals of Programming Chapter 5
Fundamentals of Programming Chapter 5
 
Computer programming 2 Lesson 7
Computer programming 2  Lesson 7Computer programming 2  Lesson 7
Computer programming 2 Lesson 7
 
Conditional and special operators
Conditional and special operatorsConditional and special operators
Conditional and special operators
 
Py-Slides-2.ppt
Py-Slides-2.pptPy-Slides-2.ppt
Py-Slides-2.ppt
 
Py-Slides-2 (1).ppt
Py-Slides-2 (1).pptPy-Slides-2 (1).ppt
Py-Slides-2 (1).ppt
 
Py-Slides-2.ppt
Py-Slides-2.pptPy-Slides-2.ppt
Py-Slides-2.ppt
 
Python operators
Python operatorsPython operators
Python operators
 
COM1407: C Operators
COM1407: C OperatorsCOM1407: C Operators
COM1407: C Operators
 

More from Jadavsejal

Programming with Java Concept: Java TimeZone Class
Programming with Java Concept: Java TimeZone ClassProgramming with Java Concept: Java TimeZone Class
Programming with Java Concept: Java TimeZone Class
Jadavsejal
 
Programming Java Concept of Event Handling
Programming Java Concept of Event HandlingProgramming Java Concept of Event Handling
Programming Java Concept of Event Handling
Jadavsejal
 
Programming Java GUI using SWING, Event Handling
Programming Java GUI using SWING, Event HandlingProgramming Java GUI using SWING, Event Handling
Programming Java GUI using SWING, Event Handling
Jadavsejal
 
concept of applet and concept of Layout Managers
concept of applet and concept of Layout Managersconcept of applet and concept of Layout Managers
concept of applet and concept of Layout Managers
Jadavsejal
 
C++ unit-2-part-3
C++ unit-2-part-3C++ unit-2-part-3
C++ unit-2-part-3
Jadavsejal
 
C++ unit-2-part-2
C++ unit-2-part-2C++ unit-2-part-2
C++ unit-2-part-2
Jadavsejal
 
C++ unit-2-part-1
C++ unit-2-part-1C++ unit-2-part-1
C++ unit-2-part-1
Jadavsejal
 
C++ unit-1-part-15
C++ unit-1-part-15C++ unit-1-part-15
C++ unit-1-part-15
Jadavsejal
 
C++ unit-1-part-14
C++ unit-1-part-14C++ unit-1-part-14
C++ unit-1-part-14
Jadavsejal
 
C++ unit-1-part-13
C++ unit-1-part-13C++ unit-1-part-13
C++ unit-1-part-13
Jadavsejal
 
C++ unit-1-part-12
C++ unit-1-part-12C++ unit-1-part-12
C++ unit-1-part-12
Jadavsejal
 
C++ unit-1-part-11
C++ unit-1-part-11C++ unit-1-part-11
C++ unit-1-part-11
Jadavsejal
 
C++ unit-1-part-10
C++ unit-1-part-10C++ unit-1-part-10
C++ unit-1-part-10
Jadavsejal
 
C++ unit-1-part-9
C++ unit-1-part-9C++ unit-1-part-9
C++ unit-1-part-9
Jadavsejal
 
C++ unit-1-part-8
C++ unit-1-part-8C++ unit-1-part-8
C++ unit-1-part-8
Jadavsejal
 
C++ unit-1-part-7
C++ unit-1-part-7C++ unit-1-part-7
C++ unit-1-part-7
Jadavsejal
 
C++ unit-1-part-6
C++ unit-1-part-6C++ unit-1-part-6
C++ unit-1-part-6
Jadavsejal
 
C++ unit-1-part-5
C++ unit-1-part-5C++ unit-1-part-5
C++ unit-1-part-5
Jadavsejal
 
C++ unit-1-part-4
C++ unit-1-part-4C++ unit-1-part-4
C++ unit-1-part-4
Jadavsejal
 
C++ unit-1-part-2
C++ unit-1-part-2C++ unit-1-part-2
C++ unit-1-part-2
Jadavsejal
 

More from Jadavsejal (20)

Programming with Java Concept: Java TimeZone Class
Programming with Java Concept: Java TimeZone ClassProgramming with Java Concept: Java TimeZone Class
Programming with Java Concept: Java TimeZone Class
 
Programming Java Concept of Event Handling
Programming Java Concept of Event HandlingProgramming Java Concept of Event Handling
Programming Java Concept of Event Handling
 
Programming Java GUI using SWING, Event Handling
Programming Java GUI using SWING, Event HandlingProgramming Java GUI using SWING, Event Handling
Programming Java GUI using SWING, Event Handling
 
concept of applet and concept of Layout Managers
concept of applet and concept of Layout Managersconcept of applet and concept of Layout Managers
concept of applet and concept of Layout Managers
 
C++ unit-2-part-3
C++ unit-2-part-3C++ unit-2-part-3
C++ unit-2-part-3
 
C++ unit-2-part-2
C++ unit-2-part-2C++ unit-2-part-2
C++ unit-2-part-2
 
C++ unit-2-part-1
C++ unit-2-part-1C++ unit-2-part-1
C++ unit-2-part-1
 
C++ unit-1-part-15
C++ unit-1-part-15C++ unit-1-part-15
C++ unit-1-part-15
 
C++ unit-1-part-14
C++ unit-1-part-14C++ unit-1-part-14
C++ unit-1-part-14
 
C++ unit-1-part-13
C++ unit-1-part-13C++ unit-1-part-13
C++ unit-1-part-13
 
C++ unit-1-part-12
C++ unit-1-part-12C++ unit-1-part-12
C++ unit-1-part-12
 
C++ unit-1-part-11
C++ unit-1-part-11C++ unit-1-part-11
C++ unit-1-part-11
 
C++ unit-1-part-10
C++ unit-1-part-10C++ unit-1-part-10
C++ unit-1-part-10
 
C++ unit-1-part-9
C++ unit-1-part-9C++ unit-1-part-9
C++ unit-1-part-9
 
C++ unit-1-part-8
C++ unit-1-part-8C++ unit-1-part-8
C++ unit-1-part-8
 
C++ unit-1-part-7
C++ unit-1-part-7C++ unit-1-part-7
C++ unit-1-part-7
 
C++ unit-1-part-6
C++ unit-1-part-6C++ unit-1-part-6
C++ unit-1-part-6
 
C++ unit-1-part-5
C++ unit-1-part-5C++ unit-1-part-5
C++ unit-1-part-5
 
C++ unit-1-part-4
C++ unit-1-part-4C++ unit-1-part-4
C++ unit-1-part-4
 
C++ unit-1-part-2
C++ unit-1-part-2C++ unit-1-part-2
C++ unit-1-part-2
 

Recently uploaded

How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 

Recently uploaded (20)

How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 

java operators

  • 1. Prepared by: Assi. Professor Sejal Jadav
  • 2. JAVA Operators Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: 1. Arithmetic Operators 2. Relational Operators 3. Bitwise Operators 4. Logical Operators 5. Assignment Operators
  • 3. The Arithmetic Operators: • Arithmetic operators are used in mathematical expressions. • The following table lists the arithmetic operators: • Assume integer variable A holds 10 and variable B holds 20, then: • int a=10; • int b=20;
  • 4. Operat or Description Example + Addition - Adds values on either side of the operator A + B will give 30 - Subtraction - Subtracts right hand operand from left hand operand A - B will give -10 * Multiplication - Multiplies values on either side of the operator A * B will give 200 / Division - Divides left hand operand by right hand operand B / A will give 2 % Modulus - Divides left hand operand by right hand operand and returns remainder B % A will give 0
  • 5. The Relational Operators: • There are following relational operators supported by Java language • Assume variable A holds 10 and variable B holds 20, then: • Int a=10; • Int b=20;
  • 6. Operato r Description Example == Checks if the values of two operands are equal or not, if yes then condition becomes true. (A == B) is not true. != Checks if the values of two operands are equal or not, if values are not equal then condition becomes true. (A != B) is true. > Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true. (A > B) is not true. < Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true. (A < B) is true. >= Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true. (A >= B) is not true. <= Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true. (A <= B) is true.
  • 7. The Logical Operators: The following table lists the logical operators: Assume Boolean variables x holds true and variable y holds false, then: Int A=10, b=10; X= (A==b) true Int c=10,d=20; Y=(c==d)  false
  • 8. Opera tor Description Example && Called Logical AND operator. If both the operands are true then the condition becomes true. (A && B) is false. || Called Logical OR Operator. If any of the two operands are true then the condition becomes true. (A || B) is true. ! Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false. !(A && B) is true. The Assignment Operators: • There are following assignment operators supported by Java language:
  • 9. Operat or Description Example = Simple assignment operator, Assigns values from right side operands to left side operand C = A + B will assign value of A + B into C += Add AND assignment operator, It adds right operand to the left operand and assign the result to left operand C += A is equivalent to C = C + A -= Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operand C -= A is equivalent to C = C - A *= Multiply AND assignment operator, It multiplies right operand with the left operand and assign the result to left operand C *= A is equivalent to C = C * A /= Divide AND assignment operator, It divides left operand with the right operand and assign the result to left operand C /= A is equivalent to C = C / A
  • 10. Operator Description + Unary plus operator; indicates positive value (numbers are positive without this, however) - Unary minus operator; negates an expression ++ Increment operator; increments a value by 1 -- Decrement operator; decrements a value by 1 ! Logical complement operator; inverts the value of a boolean The Unary Operators • The unary operators require only one operand; they perform various operations • such as incrementing/decrementing a value by one, negating an expression, • or inverting the value of a boolean.