SlideShare a Scribd company logo
1 of 15
Download to read offline
Operators in java
What is an operator?
● Operators are special symbols that perform
specific operations on one, two, or three
operands, and then return a result.
● Operators with one operand are called unary
operators
● Operators with two operands are called binary
operators
● Operators with three operands are called ternary
operator
Operators available in java
● Assignment operators
● Arithmatic operators
● InstanceOf operator
● Relational operators
● Conditional operators
● Logical operators
Assignment operator
● The = is called the assignment operator.
● The = operator is used to assign the value
present to its right to the operand present to its
left.
● eg.,
int a=10, b;
b=a;
Arithmatic operators
The basic arithmatic operators are
+ addition
- subtraction
* multiplication
/ division
% modulo
String concatenation operator
● The + sign can also be used to concatenate
two strings.
● Example
● String a =”hello”, b=”world”;
● System.out.println(a + b) will result as
helloworld
Increment or Decrement operators
● The ++ is the increment operator.
● The -- is the decrement operator.
● There are two types based on the position of
the operator with the operand.
● Postfix : ++ or -- to the right of the operand
● Prefix : ++ or -- to the left of the operand
Compound assignment operators
● The most commonly used compound
assignment operators are
✔ +=
✔ -=
✔ *=
✔ /=
Relational operators
● The list of relational operators in java are
== Equal to
!= Not equal to
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
Conditinal operator
● The conditional operator is the ternary
operator.
● The syntax of conditional operator is
x=(boolean expression)?true:false ;
InstanceOf operator
● The instanceof operator is used for object reference
variables only.
● It can be used to check whether an object is of a
particular type.
● The instanceOf operator returns either true or false.
● Example:
Classname b = new Classname();
boolean a = b instanceOf Classname;
Logical operators
● Bitwise operators
– &
– |
– ^
● Shorthand operators
– && - logical AND
– || - logical OR
Sample code for operatos
Sample output
Thank you

More Related Content

What's hot

Operators and Expressions in Java
Operators and Expressions in JavaOperators and Expressions in Java
Operators and Expressions in Java
Abhilash Nair
 
Introduction to Java Programming Language
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming Language
jaimefrozr
 

What's hot (20)

Operators in java presentation
Operators in java presentationOperators in java presentation
Operators in java presentation
 
Exception handling
Exception handlingException handling
Exception handling
 
Interface in java
Interface in javaInterface in java
Interface in java
 
Methods in Java
Methods in JavaMethods in Java
Methods in Java
 
Presentation on-exception-handling
Presentation on-exception-handlingPresentation on-exception-handling
Presentation on-exception-handling
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
 
Java Presentation For Syntax
Java Presentation For SyntaxJava Presentation For Syntax
Java Presentation For Syntax
 
Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
 
Control flow statements in java
Control flow statements in javaControl flow statements in java
Control flow statements in java
 
Data Types, Variables, and Operators
Data Types, Variables, and OperatorsData Types, Variables, and Operators
Data Types, Variables, and Operators
 
Exception handling
Exception handlingException handling
Exception handling
 
java programming- control statements
 java programming- control statements java programming- control statements
java programming- control statements
 
Data types in java
Data types in javaData types in java
Data types in java
 
Operators and Expressions in Java
Operators and Expressions in JavaOperators and Expressions in Java
Operators and Expressions in Java
 
Java Tokens
Java  TokensJava  Tokens
Java Tokens
 
Java Data Types
Java Data TypesJava Data Types
Java Data Types
 
Data Types & Variables in JAVA
Data Types & Variables in JAVAData Types & Variables in JAVA
Data Types & Variables in JAVA
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
 
Core java complete ppt(note)
Core java  complete  ppt(note)Core java  complete  ppt(note)
Core java complete ppt(note)
 
Introduction to Java Programming Language
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming Language
 

Viewers also liked

Control statements in Java
Control statements  in JavaControl statements  in Java
Control statements in Java
Jin Castor
 
Operators and expressions
Operators and expressionsOperators and expressions
Operators and expressions
vishaljot_kaur
 
Sean's Resume 2015 (Linkedin update )
Sean's Resume 2015 (Linkedin update )Sean's Resume 2015 (Linkedin update )
Sean's Resume 2015 (Linkedin update )
Sean Fitzgerald
 
InsideSales Overview 2016
InsideSales Overview 2016InsideSales Overview 2016
InsideSales Overview 2016
Dan Cone
 

Viewers also liked (20)

Control statements in Java
Control statements  in JavaControl statements  in Java
Control statements in Java
 
OpenStack in Action 4! Thierry Carrez - From Havana to Icehouse
OpenStack in Action 4! Thierry Carrez - From Havana to IcehouseOpenStack in Action 4! Thierry Carrez - From Havana to Icehouse
OpenStack in Action 4! Thierry Carrez - From Havana to Icehouse
 
Getting Started With OpenStack Icehouse Release
Getting Started With OpenStack Icehouse ReleaseGetting Started With OpenStack Icehouse Release
Getting Started With OpenStack Icehouse Release
 
Java basic operators
Java basic operatorsJava basic operators
Java basic operators
 
OpenStack Icehouse Overview
OpenStack Icehouse OverviewOpenStack Icehouse Overview
OpenStack Icehouse Overview
 
Java 2
Java 2Java 2
Java 2
 
itft-Operators in java
itft-Operators in javaitft-Operators in java
itft-Operators in java
 
Regular Expressions in Java
Regular Expressions in JavaRegular Expressions in Java
Regular Expressions in Java
 
Control structures i
Control structures i Control structures i
Control structures i
 
15 bitwise operators
15 bitwise operators15 bitwise operators
15 bitwise operators
 
Neutron Icehouse Update (Japanese)
Neutron Icehouse Update (Japanese)Neutron Icehouse Update (Japanese)
Neutron Icehouse Update (Japanese)
 
neutron_icehouse_update
neutron_icehouse_updateneutron_icehouse_update
neutron_icehouse_update
 
Java
Java Java
Java
 
Operators and expressions
Operators and expressionsOperators and expressions
Operators and expressions
 
Cloud Computing Using OpenStack
Cloud Computing Using OpenStack Cloud Computing Using OpenStack
Cloud Computing Using OpenStack
 
OpenStack Architecture
OpenStack ArchitectureOpenStack Architecture
OpenStack Architecture
 
Sean's Resume 2015 (Linkedin update )
Sean's Resume 2015 (Linkedin update )Sean's Resume 2015 (Linkedin update )
Sean's Resume 2015 (Linkedin update )
 
ラルフローレン塗料とクーポンコードでお金を節約する方法
ラルフローレン塗料とクーポンコードでお金を節約する方法ラルフローレン塗料とクーポンコードでお金を節約する方法
ラルフローレン塗料とクーポンコードでお金を節約する方法
 
Faap mar/2003
Faap mar/2003Faap mar/2003
Faap mar/2003
 
InsideSales Overview 2016
InsideSales Overview 2016InsideSales Overview 2016
InsideSales Overview 2016
 

Similar to Operators in java

Similar to Operators in java (20)

OCA JAVA - 3 Programming with Java Operators
 OCA JAVA - 3 Programming with Java Operators OCA JAVA - 3 Programming with Java Operators
OCA JAVA - 3 Programming with Java Operators
 
operators in c++
operators in c++operators in c++
operators in c++
 
operators in c++
operators in c++operators in c++
operators in c++
 
Operators in Python
Operators in PythonOperators in Python
Operators in Python
 
JavaScript Operators
JavaScript OperatorsJavaScript Operators
JavaScript Operators
 
Operator in c programming
Operator in c programmingOperator in c programming
Operator in c programming
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
 
Types of Operators in C
Types of Operators in CTypes of Operators in C
Types of Operators in C
 
OPERATORS OF C++
OPERATORS OF C++OPERATORS OF C++
OPERATORS OF C++
 
Operator
OperatorOperator
Operator
 
Operators-WPS Office.pdf
Operators-WPS Office.pdfOperators-WPS Office.pdf
Operators-WPS Office.pdf
 
SPL 6 | Operators in C
SPL 6 | Operators in CSPL 6 | Operators in C
SPL 6 | Operators in C
 
L3 operators
L3 operatorsL3 operators
L3 operators
 
L3 operators
L3 operatorsL3 operators
L3 operators
 
L3 operators
L3 operatorsL3 operators
L3 operators
 
Operators
OperatorsOperators
Operators
 
OCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & StatementsOCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & Statements
 
Chapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B KuteChapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B Kute
 
Unit ii chapter 1 operator and expressions in c
Unit ii chapter 1 operator and expressions in cUnit ii chapter 1 operator and expressions in c
Unit ii chapter 1 operator and expressions in c
 
Operators in java By cheena
Operators in java By cheenaOperators in java By cheena
Operators in java By cheena
 

More from Muthukumaran Subramanian

More from Muthukumaran Subramanian (20)

Struts introduction
Struts introductionStruts introduction
Struts introduction
 
Threads concept in java
Threads concept in javaThreads concept in java
Threads concept in java
 
StringTokenizer in java
StringTokenizer in javaStringTokenizer in java
StringTokenizer in java
 
Overriding methods
Overriding methodsOverriding methods
Overriding methods
 
Oops (inheritance&interface)
Oops (inheritance&interface)Oops (inheritance&interface)
Oops (inheritance&interface)
 
Non access modifiers
Non access modifiersNon access modifiers
Non access modifiers
 
Jdbc connectivity in java
Jdbc connectivity in javaJdbc connectivity in java
Jdbc connectivity in java
 
Garbage collection in java
Garbage collection in javaGarbage collection in java
Garbage collection in java
 
Files in java
Files in javaFiles in java
Files in java
 
Exception handling
Exception handlingException handling
Exception handling
 
Date class
Date classDate class
Date class
 
Currency class
Currency classCurrency class
Currency class
 
Timer class in java
Timer class in javaTimer class in java
Timer class in java
 
Calendar class in java
Calendar class in javaCalendar class in java
Calendar class in java
 
Classes and objects in java
Classes and objects in javaClasses and objects in java
Classes and objects in java
 
intorduction to Arrays in java
intorduction to Arrays in javaintorduction to Arrays in java
intorduction to Arrays in java
 
Access modifiers in java
Access modifiers in javaAccess modifiers in java
Access modifiers in java
 
Abstract classes
Abstract classesAbstract classes
Abstract classes
 
Java introduction
Java introductionJava introduction
Java introduction
 
Collections and generics
Collections and genericsCollections and generics
Collections and generics
 

Recently uploaded

Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Recently uploaded (20)

Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 

Operators in java

  • 2. What is an operator? ● Operators are special symbols that perform specific operations on one, two, or three operands, and then return a result. ● Operators with one operand are called unary operators ● Operators with two operands are called binary operators ● Operators with three operands are called ternary operator
  • 3. Operators available in java ● Assignment operators ● Arithmatic operators ● InstanceOf operator ● Relational operators ● Conditional operators ● Logical operators
  • 4. Assignment operator ● The = is called the assignment operator. ● The = operator is used to assign the value present to its right to the operand present to its left. ● eg., int a=10, b; b=a;
  • 5. Arithmatic operators The basic arithmatic operators are + addition - subtraction * multiplication / division % modulo
  • 6. String concatenation operator ● The + sign can also be used to concatenate two strings. ● Example ● String a =”hello”, b=”world”; ● System.out.println(a + b) will result as helloworld
  • 7. Increment or Decrement operators ● The ++ is the increment operator. ● The -- is the decrement operator. ● There are two types based on the position of the operator with the operand. ● Postfix : ++ or -- to the right of the operand ● Prefix : ++ or -- to the left of the operand
  • 8. Compound assignment operators ● The most commonly used compound assignment operators are ✔ += ✔ -= ✔ *= ✔ /=
  • 9. Relational operators ● The list of relational operators in java are == Equal to != Not equal to < Less than > Greater than <= Less than or equal to >= Greater than or equal to
  • 10. Conditinal operator ● The conditional operator is the ternary operator. ● The syntax of conditional operator is x=(boolean expression)?true:false ;
  • 11. InstanceOf operator ● The instanceof operator is used for object reference variables only. ● It can be used to check whether an object is of a particular type. ● The instanceOf operator returns either true or false. ● Example: Classname b = new Classname(); boolean a = b instanceOf Classname;
  • 12. Logical operators ● Bitwise operators – & – | – ^ ● Shorthand operators – && - logical AND – || - logical OR
  • 13. Sample code for operatos