Operators in Java
Comparison Operators are the Operators which return a boolean value as the result means the answer will be either true or false.
Operators |
Meaning |
True |
False |
---|---|---|---|
== |
Equal |
1==1 |
1==2 |
!= |
Not Equal |
1!=2 |
1!=1 |
< |
Less Than |
1<2 |
2<1 |
<= |
Less Than Equal to |
1<=1 |
2<=1 |
> |
Greater Than |
3>2 |
2>3 |
>= |
Greater Than Equal to |
3>=3 |
2>=3 |
Precedence and Associativity of Operator in Java
Here is the table representing the precedence order of Java operators from high to low as we move from top to bottom.
Operators | Associativity | Type |
---|---|---|
++, – | Right to Left | Unary postfix |
++, –, +, -, ! | Right to Left | Unary prefix |
/, *, % | Left to Right | Multiplicative |
+, – | Left to Right | Additive |
<, <=, >, >= | Left to Right | Relational |
==, !== | Left to Right | Equality |
& | Left to Right | Boolean Logical AND |
^ | Left to Right | Boolean Logical Exclusive OR |
| | Left to Right | Boolean Logical Inclusive OR |
&& | Left to Right | Conditional AND |
|| | Left to Right | Conditional OR |
?: | Right to Left | Conditional |
=, +=, -=, *=, /=, %= | Right to Left | Assignment |
Java Cheat Sheet
Java is a programming language and platform that has been widely used since its development by James Gosling in 1982. It follows the Object-oriented Programming concept and can run programs written in any programming language. Java is a high-level, object-oriented, secure, robust, platform-independent, multithreaded, and portable programming language All those words are collectively called Java Buzzwords. It is commonly used for programming web-based, window, enterprise, and mobile applications. This Java Cheat Sheet article has been written by experts in Java and based on the experience of students who have recently undergone Java interviews.
This Core Java Cheat Sheet has been designed by Java experts, based on the experience of students who have recently undergone Java interviews. Whether you are a beginner or an experienced Java developer, this Java Cheat Sheet is a valuable resource for quickly accessing essential syntax, concepts, and best practices related to Java Programming.
Contact Us