💻 Step 9: Java Operators – 6th hour +code

Learn with our youtube video

💡Definition

-Set of symbols to perform specific operation.

💡Operators Categories-

Quick Overview of various operators in java-

OperatorDescriptionExample
+Addition5 + 2
-Subtraction5 - 2
*Multiplication5 * 2
/Division5 / 2
%Modulus (remainder)5 % 2
++Incrementi++
--Decrementi--
==Equal toa == b
!=Not equal toa != b
>Greater thana > b
<Less thana < b
>=Greater than or equal toa >= b
<=Less than or equal toa <= b
&&Logical anda && b
||Logical ora || b
!Logical not!a
instanceofDetermines if an object is an instance of a particular class or implements a particular interfaceobj instanceof MyClass
=Assignmenta = b
+=Addition assignmenta += b
-=Subtraction assignmenta -= b
*=Multiplication assignmenta *= b
/=Division assignmenta /= b
%=Modulus assignmenta %= b
? :Ternary (conditional) operatora ? b : c

💡1-Arithmetic and Assignment operators-

arithmetic-operators

ao1

ao1

💡2-Relational operators-

relational-operators

ao1

💡3-Logical operators –

ao1

💡4-Misc operators ( ?: (if-else-then), instanceof)

ao1

 

Interview Questions —

  • What is difference between arithmetic and relational operators
  • What is instanceOf operator?
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.