SlideShare a Scribd company logo
1 of 16
Patna College Patna
Bachelor of Computer Application
Presented by:-
Abhishek Kumar
Roll No:- 27 &
Kanhaiya Kumar
Roll No:- 28
OPERATORS IN JAVA
OPERATORS
• Operators are the predefined symbolic instructions
which are used to perform the operations on
operands (data).
Like ‘C’, ‘Java’ also support 8 types of operators
1. Arithmetic Operator
2. Relational / Comparison operator
3. Logical operator
4. Assignment operator
5. Increment /Decrement operator
6. Conditional operator
7. Bitwise operator
8. Special operator
1. ARITHMETIC OPERATOR
 These operator are used to perform arithmetical operation.
Operator Name Symbol
Addition +
Subtraction -
Multiplication *
Division /
Modulus %
2. RELATIONAL / COMPARISON OPERATOR
 These operator are used to compare two operands together.
Operator name symbol
Greater than >
Greater than equal to >=
less than equal to <=
less than <
Equal to ==
Not equal to !=
 3. LOGICAL OPERATOR
 These operator are used to combine two or more
condition together.
Operator name Symbol
AND &&
OR !!
NOT !
4. ASSIGNMENT OPERATOR
 Equal to sign is called assignment operator it is used
to assign some value or expression into a variable.
 Assignment always take place right to left.
a=b
b=30
c=a+b
5. INCREMENT/ DECREMENT OPERATOR
 ‘++’ is called increment operator and
 ‘- -’ is called decrement operator .
 It is used to increase or decrease the values of variable by 1.
a++ a=a+1// postfix notation
++a a=a+1// prefix notation
b-- b=b-1//postfix
--b b=b-1//prefix
Postfix Operator
• int a=5, b;
b=a++ a=6
Assignment at first b=5 and then decrement.
int a=4, b;
b=a-- ; a=3
b=4
Prefix Operator
int a=5, b;
B=++a; a=6
b=6
increment at first and then assigned
Example:- int a=4,b;
B=--a, a=3
b=3
6. CONDITIONAL OPERATOR (‘?’ , ‘:’)
 ‘? :’ is simultaneously called as conditional operator.
 It is used to assign some value or expression into a
variable on some condition
 v= (condition ? Expression 1: expression 2);
 possible output 1. if true
 2. true value
 3. false value
 4. if false
• Int a=5, b=10,c;
C=(a>b? 50:40)
System.out.print (c); 40
C(a<b? A+b: a-b)
System.out.print(c); 15
7. BITWISE OPERATOR
 These operator are used to perform the operation on bit values (0,1) so
these are specially used for bit level programming.
A). Bitwise logical
AND - &
OR - !
XOR - ^
B). Shift operator
left shift - <<
right shift - >>
C). Bitwise complement operator
NOT - ~ (TILDE)
8. SPECIAL OPERATOR
 Comma(,) and “ instance of” are called as special operator.
 Comma (,); operator is not supported by java.
 int a,b,c ;
use of comma
 INATANCE OFF:- It is used to take whether an object belongs to
particular class or not.
THANK
YOU!

More Related Content

Similar to Operator in JAVA (20)

operators.pptx
operators.pptxoperators.pptx
operators.pptx
 
C++ revision tour
C++ revision tourC++ revision tour
C++ revision tour
 
operator
operatoroperator
operator
 
Operators expressions-and-statements
Operators expressions-and-statementsOperators expressions-and-statements
Operators expressions-and-statements
 
C++ revision tour
C++ revision tourC++ revision tour
C++ revision tour
 
C Operators
C OperatorsC Operators
C Operators
 
operators and expressions in c++
 operators and expressions in c++ operators and expressions in c++
operators and expressions in c++
 
Step by step python(week2)
Step by step python(week2)Step by step python(week2)
Step by step python(week2)
 
Increment and Decrement operators in C++
Increment and Decrement operators in C++Increment and Decrement operators in C++
Increment and Decrement operators in C++
 
Operators
OperatorsOperators
Operators
 
05 operators
05   operators05   operators
05 operators
 
Operators in Python Arithmetic Operators
Operators in Python Arithmetic OperatorsOperators in Python Arithmetic Operators
Operators in Python Arithmetic Operators
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
 
Operator & Expression in c++
Operator & Expression in c++Operator & Expression in c++
Operator & Expression in c++
 
Ch4 Expressions
Ch4 ExpressionsCh4 Expressions
Ch4 Expressions
 
Operators in Python
Operators in PythonOperators in Python
Operators in Python
 
Python Programming | JNTUK | UNIT 1 | Lecture 5
Python Programming | JNTUK | UNIT 1 | Lecture 5Python Programming | JNTUK | UNIT 1 | Lecture 5
Python Programming | JNTUK | UNIT 1 | Lecture 5
 
DSA 103 Object Oriented Programming :: Week 2
DSA 103 Object Oriented Programming :: Week 2DSA 103 Object Oriented Programming :: Week 2
DSA 103 Object Oriented Programming :: Week 2
 
Operators
OperatorsOperators
Operators
 

Recently uploaded

NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024EMMANUELLEFRANCEHELI
 
01-vogelsanger-stanag-4178-ed-2-the-new-nato-standard-for-nitrocellulose-test...
01-vogelsanger-stanag-4178-ed-2-the-new-nato-standard-for-nitrocellulose-test...01-vogelsanger-stanag-4178-ed-2-the-new-nato-standard-for-nitrocellulose-test...
01-vogelsanger-stanag-4178-ed-2-the-new-nato-standard-for-nitrocellulose-test...AshwaniAnuragi1
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...josephjonse
 
Adsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptAdsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptjigup7320
 
Artificial Intelligence in due diligence
Artificial Intelligence in due diligenceArtificial Intelligence in due diligence
Artificial Intelligence in due diligencemahaffeycheryld
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docxrahulmanepalli02
 
5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...archanaece3
 
Autodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxAutodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxMustafa Ahmed
 
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfInstruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfEr.Sonali Nasikkar
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsMathias Magdowski
 
DBMS-Report on Student management system.pptx
DBMS-Report on Student management system.pptxDBMS-Report on Student management system.pptx
DBMS-Report on Student management system.pptxrajjais1221
 
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...Amil baba
 
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptxSLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptxCHAIRMAN M
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Ramkumar k
 
handbook on reinforce concrete and detailing
handbook on reinforce concrete and detailinghandbook on reinforce concrete and detailing
handbook on reinforce concrete and detailingAshishSingh1301
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Studentskannan348865
 
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样A
 
CLOUD COMPUTING SERVICES - Cloud Reference Modal
CLOUD COMPUTING SERVICES - Cloud Reference ModalCLOUD COMPUTING SERVICES - Cloud Reference Modal
CLOUD COMPUTING SERVICES - Cloud Reference ModalSwarnaSLcse
 
analog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxanalog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxKarpagam Institute of Teechnology
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisDr.Costas Sachpazis
 

Recently uploaded (20)

NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
 
01-vogelsanger-stanag-4178-ed-2-the-new-nato-standard-for-nitrocellulose-test...
01-vogelsanger-stanag-4178-ed-2-the-new-nato-standard-for-nitrocellulose-test...01-vogelsanger-stanag-4178-ed-2-the-new-nato-standard-for-nitrocellulose-test...
01-vogelsanger-stanag-4178-ed-2-the-new-nato-standard-for-nitrocellulose-test...
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
 
Adsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptAdsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) ppt
 
Artificial Intelligence in due diligence
Artificial Intelligence in due diligenceArtificial Intelligence in due diligence
Artificial Intelligence in due diligence
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx
 
5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...
 
Autodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxAutodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptx
 
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfInstruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility Applications
 
DBMS-Report on Student management system.pptx
DBMS-Report on Student management system.pptxDBMS-Report on Student management system.pptx
DBMS-Report on Student management system.pptx
 
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
 
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptxSLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
handbook on reinforce concrete and detailing
handbook on reinforce concrete and detailinghandbook on reinforce concrete and detailing
handbook on reinforce concrete and detailing
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Students
 
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样
 
CLOUD COMPUTING SERVICES - Cloud Reference Modal
CLOUD COMPUTING SERVICES - Cloud Reference ModalCLOUD COMPUTING SERVICES - Cloud Reference Modal
CLOUD COMPUTING SERVICES - Cloud Reference Modal
 
analog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxanalog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptx
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
 

Operator in JAVA

  • 1. Patna College Patna Bachelor of Computer Application Presented by:- Abhishek Kumar Roll No:- 27 & Kanhaiya Kumar Roll No:- 28
  • 3. OPERATORS • Operators are the predefined symbolic instructions which are used to perform the operations on operands (data).
  • 4. Like ‘C’, ‘Java’ also support 8 types of operators 1. Arithmetic Operator 2. Relational / Comparison operator 3. Logical operator 4. Assignment operator 5. Increment /Decrement operator 6. Conditional operator 7. Bitwise operator 8. Special operator
  • 5. 1. ARITHMETIC OPERATOR  These operator are used to perform arithmetical operation. Operator Name Symbol Addition + Subtraction - Multiplication * Division / Modulus %
  • 6. 2. RELATIONAL / COMPARISON OPERATOR  These operator are used to compare two operands together. Operator name symbol Greater than > Greater than equal to >= less than equal to <= less than < Equal to == Not equal to !=
  • 7.  3. LOGICAL OPERATOR  These operator are used to combine two or more condition together. Operator name Symbol AND && OR !! NOT !
  • 8. 4. ASSIGNMENT OPERATOR  Equal to sign is called assignment operator it is used to assign some value or expression into a variable.  Assignment always take place right to left. a=b b=30 c=a+b
  • 9. 5. INCREMENT/ DECREMENT OPERATOR  ‘++’ is called increment operator and  ‘- -’ is called decrement operator .  It is used to increase or decrease the values of variable by 1. a++ a=a+1// postfix notation ++a a=a+1// prefix notation b-- b=b-1//postfix --b b=b-1//prefix
  • 10. Postfix Operator • int a=5, b; b=a++ a=6 Assignment at first b=5 and then decrement. int a=4, b; b=a-- ; a=3 b=4
  • 11. Prefix Operator int a=5, b; B=++a; a=6 b=6 increment at first and then assigned Example:- int a=4,b; B=--a, a=3 b=3
  • 12. 6. CONDITIONAL OPERATOR (‘?’ , ‘:’)  ‘? :’ is simultaneously called as conditional operator.  It is used to assign some value or expression into a variable on some condition  v= (condition ? Expression 1: expression 2);  possible output 1. if true  2. true value  3. false value  4. if false
  • 13. • Int a=5, b=10,c; C=(a>b? 50:40) System.out.print (c); 40 C(a<b? A+b: a-b) System.out.print(c); 15
  • 14. 7. BITWISE OPERATOR  These operator are used to perform the operation on bit values (0,1) so these are specially used for bit level programming. A). Bitwise logical AND - & OR - ! XOR - ^ B). Shift operator left shift - << right shift - >> C). Bitwise complement operator NOT - ~ (TILDE)
  • 15. 8. SPECIAL OPERATOR  Comma(,) and “ instance of” are called as special operator.  Comma (,); operator is not supported by java.  int a,b,c ; use of comma  INATANCE OFF:- It is used to take whether an object belongs to particular class or not.