The symbols used in a Java expression are known as Operators, whereas the values on which the operations are performed are known as Operands. There are three types of operators :
1. Unary Operator : These are the operators which require only one operand to perform the operation.
2. Binary Operator : These are the operators which require two operands to perform the operation.
3. Tertiary Operator : These are the operators which require three operands to perform the operation.
The operators are also classified on the basis of their types of operation :
1. Arithmetical Operators
2. Relational Operators
3. Logical Operators
4. Bitwise Operators
5. Assignment Operator
6. Compound Assignment Operator (Short Hand Operator)
1. Arithmetical Operators : These operators are required for arithmetical calculations. They are of two types :
1. Binary Operators : The table given below lists all binary form arithmetical operators in Java :
2. Unary Operators : Operators + and - have a unary form too, in addition to binary forms. They are illustrated along with their functions in the table given below :
The operators ++ and -- are the two shortcut arithmetic operators. They are used as follows :
1. x++ stands for x=x+1.
2. x-- stands for x=x-1.
They have two versions :
1. The Prefix version : Increments/decrements the value of the operand by 1 before doing the operation with it.
1. The Postfix version : Increments/decrements the value of the operand by 1 after doing the operation with it.
The table given below shows these operators :
2. Relational Operators : The relational operators in Java are used to compare the values of two operands a and b and results in the outcome of a boolean value. These are given in the table below :
5. Assignment Operator : The assignment operator = is used to assign value to a variable or to initialize them. For example :
int a=10;
float b=99.99;
6. Compound Assignment Operator (Short Hand Operator) : These operators are just like a shortcut assignment operator. They are given in the table below :
1. Unary Operator : These are the operators which require only one operand to perform the operation.
2. Binary Operator : These are the operators which require two operands to perform the operation.
3. Tertiary Operator : These are the operators which require three operands to perform the operation.
The operators are also classified on the basis of their types of operation :
1. Arithmetical Operators
2. Relational Operators
3. Logical Operators
4. Bitwise Operators
5. Assignment Operator
6. Compound Assignment Operator (Short Hand Operator)
1. Arithmetical Operators : These operators are required for arithmetical calculations. They are of two types :
1. Binary Operators : The table given below lists all binary form arithmetical operators in Java :
Operator | Description | Function | Example |
+ | Plus | Adds the operands | a+b |
- | Minus | Subtracts the operands | a-b |
* | Multiply | Multiplies the operands | a*b |
/ | Divide | Divides the operands | a/b |
% | Modulus (Remainder) | Finds the remainder when one number is divided by the other | a%b |
2. Unary Operators : Operators + and - have a unary form too, in addition to binary forms. They are illustrated along with their functions in the table given below :
Operator | Description | Example |
+ | Promotes a to int if it’s a byte, short, or char | +a |
- | Arithmetically negates a | -a |
The operators ++ and -- are the two shortcut arithmetic operators. They are used as follows :
1. x++ stands for x=x+1.
2. x-- stands for x=x-1.
They have two versions :
1. The Prefix version : Increments/decrements the value of the operand by 1 before doing the operation with it.
1. The Postfix version : Increments/decrements the value of the operand by 1 after doing the operation with it.
The table given below shows these operators :
Operator | Description | Example |
++ | Increments a by 1 after performing the operation with it | a++ |
++ | Increments a by 1 before performing the operation with it | ++a |
-- | Decrements a by 1 after performing the operation with it | a-- |
-- | Decrements a by 1 before performing the operation with it | --a |
2. Relational Operators : The relational operators in Java are used to compare the values of two operands a and b and results in the outcome of a boolean value. These are given in the table below :
Operator | Description | Example |
> | Greater than | a>b |
< | Less than | a<b |
>= | Greater then equal to | a>=b |
<= | Less than equal to | a<=b |
= = | Equal to | a= =b |
!= | Not equal to | a!=b |
3. Logical Operators : These operators in Java are used to return a boolean value from an expression containing two or more comparisons. Java supports six logical operators, out of which five are binary and one is unary. The table belows shows these operators :
Operator | Description | Example |
&& | Short-circuit or conditional AND | a&&b |
|| | Short-circuit or conditional OR | a||b |
! | Logical NOT | !a |
& | Logical AND | a&b |
| | Logical OR | a|b |
^ | Logical XOR (exclusive OR) | a^b |
5. Assignment Operator : The assignment operator = is used to assign value to a variable or to initialize them. For example :
int a=10;
float b=99.99;
6. Compound Assignment Operator (Short Hand Operator) : These operators are just like a shortcut assignment operator. They are given in the table below :
Compound Assignment Operator | Arithmetic Operator |
a+=b | a=a+b |
a-=b | a=a-b |
a*=b | a=a*b |
a/=b | a=a/b |
I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
ReplyDeleteClick here:
angularjs training in btm
angularjs training in rajajinagar |angularjs training in marathahalli
I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.
ReplyDeleteClick here:
Microsoft azure training in velarchery
Click here:
Microsoft azure training in sollinganallur
I have read a few of the articles on your website now, and I really like your style of blogging. I added it to my favourites blog site list and will be checking back soon.
ReplyDeleteData Science Training in Chennai | Data Science training in anna nagar
Data Science training in chennai | Data science training in Bangalore
Data Science training in marathahalli | Data Science training in btm
Thank you for benefiting from time to focus on this kind of, I feel firmly about it and also really like comprehending far more with this particular subject matter. In case doable, when you get know-how, is it possible to thoughts modernizing your site together with far more details? It’s extremely useful to me.
ReplyDeletejava training in tambaram | java training in velachery
java training in omr | oracle training in chennai
I likable the posts and offbeat format you've got here! I’d wish many thanks for sharing your expertise and also the time it took to post!!
ReplyDeleteangularjs Training in chennai
angularjs Training in chennai
angularjs-Training in tambaram
angularjs-Training in sholinganallur
angularjs-Training in velachery
Thank you so much for a well written, easy to understand article on this. It can get really confusing when trying to explain it – but you did a great job. Thank you!
ReplyDeleteMicrosoft Azure online training
Selenium online training
Java online training
Python online training
uipath online training
mmorpg
ReplyDeleteınstagram takipci satin al
tiktok jeton hilesi
tiktok jeton hilesi
antalya saç ekimi
Instagram takipci
instagram takipçi satın al
metin2 pvp serverlar
instagram takipçi satın al
Smm Panel
ReplyDeleteSMM PANEL
iş ilanları
İnstagram Takipçi Satın Al
hirdavatci burada
beyazesyateknikservisi.com.tr
Servis
tiktok jeton hilesi
tuzla lg klima servisi
ReplyDeletetuzla alarko carrier klima servisi
beykoz arçelik klima servisi
üsküdar arçelik klima servisi
kadıköy bosch klima servisi
maltepe arçelik klima servisi
beykoz vestel klima servisi
üsküdar vestel klima servisi
beykoz bosch klima servisi
It s a very useful page. Thank you. f0511030f52716e34682f12d7f542c23
ReplyDeletedaday
ermenek
kavaklidere
marmaris
tonya
ergene
kurtun
abana
torbali
Congratulations on your article, it was very helpful and successful. a536d499dff30976b03af398e0af8cb3
ReplyDeletewebsite kurma
website kurma
numara onay
Thank you for your explanation, very good content. 5f9e1a740ab51fc942b0ff7d003e82dd
ReplyDeletedefine dedektörü
Thanks for your article. 579fd512e3a1839bdbf4b4cf1f6148e1
ReplyDeleteevden iş imkanı
Good content. You write beautiful things.
ReplyDeletetaksi
korsan taksi
vbet
mrbahis
vbet
mrbahis
hacklink
sportsbet
sportsbet
Good text Write good content success. Thank you
ReplyDeletekibris bahis siteleri
poker siteleri
tipobet
betpark
mobil ödeme bahis
bonus veren siteler
betmatik
slot siteleri
çorum
ReplyDeleteantep
ısparta
hatay
mersin
L2AJX0
salt likit
ReplyDeletesalt likit
dr mood likit
big boss likit
dl likit
dark likit
Y58QWN
شركة تنظيف بالجبيل
ReplyDeleteشركة تسليك مجاري
دهان سيليكات
ReplyDeleteعازل اسمنتي للسطح
شركة تنظيف بالاحساء SGSCXvJFVG
ReplyDelete