{"id":267,"date":"2015-12-08T07:14:12","date_gmt":"2015-12-08T07:14:12","guid":{"rendered":"http:\/\/abhiandroid.com\/java\/?page_id=267"},"modified":"2018-06-05T06:39:30","modified_gmt":"2018-06-05T06:39:30","slug":"operators-in-java","status":"publish","type":"page","link":"https:\/\/abhiandroid.com\/java\/operators-in-java","title":{"rendered":"Operator In JAVA With Examples"},"content":{"rendered":"<p>In computer programming Operator is a symbol that tells the compiler to perform specific action which can be mathematical or logical. For example: \u2018+\u2019 is a additive operator which does addition of two number and can also be used for String concatenation.<\/p>\n<p>Lets take simple example to understand operator:<\/p>\n<p>int x = 4 + 5 \u2013 7;<\/p>\n<p>In the above example:<\/p>\n<ul>\n<li>\u2018+\u2019 and \u2018\u2013\u2018 are addition and subtraction operator respectively which comes under Arithmetic Operator.)<\/li>\n<li>\u201c4\u201d, \u201c5\u201d and \u201c7\u201d are operand (Operand are objects that are manipulated by operator).<\/li>\n<li>\u201c=\u201d is an assignment operator which assign result of calculation (value 2 in this case) to x.<\/li>\n<\/ul>\n<p><span style=\"color: #ff0000;\"><strong>Important Note:<\/strong><\/span> Just want to make a short notice here after learning different types of operator in JAVA don\u2019t miss the next topic operator precedence which is shared just below this topic. Operator learning is incomplete without knowing operator precedence.<\/p>\n<hr \/>\n<h4><strong>Different Types Of Operator In JAVA:<\/strong><\/h4>\n<p>JAVA supports 7 types of operator:<\/p>\n<p><span style=\"color: #008000;\"><strong><span style=\"text-decoration: underline;\">SIMPLE ASSIGNMENT OPERATOR:<\/span><\/strong><\/span><\/p>\n<p>\u201c=\u201d is assignment operator in JAVA language which assign the value of its right side to its left side value. The right side value can be of variable, constant or <a href=\"\/java\/expression-statement-code-blocks-in-java\">expression<\/a> that result some value and left side can be a variable or object which has the capacity to possess that right side value . It is evaluated from right to left.<\/p>\n<p>Example of assignment operator:<\/p>\n<pre>int x = 5;<\/pre>\n<p>Here value 5 is assigned to integer variable x.<\/p>\n<p><span style=\"color: #008000;\"><strong><span style=\"text-decoration: underline;\">ARITHMETIC OPERATOR:<\/span><\/strong><\/span><\/p>\n<p>There are 5 types of arithmetic operator in JAVA: addition (+), subtraction (-), division (\/), multiplication (*) and remainder (%) operator.<\/p>\n<p><center><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-380\" src=\"\/java\/wp-content\/uploads\/2015\/12\/Airthmetic-Operator.jpg\" alt=\"Airthmetic Operator\" width=\"540\" height=\"241\" srcset=\"https:\/\/abhiandroid.com\/java\/wp-content\/uploads\/2015\/12\/Airthmetic-Operator.jpg 540w, https:\/\/abhiandroid.com\/java\/wp-content\/uploads\/2015\/12\/Airthmetic-Operator-300x134.jpg 300w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/center><br \/>\n<span style=\"color: #993366;\"><strong>+ (Addition Operator):<\/strong><\/span><\/p>\n<p>\u201c+\u201d is binary operator which adds two operands. Example of + operator:<\/p>\n<pre>int x = 10;\r\nint y = 5;\r\nint z = x + y;<\/pre>\n<p>Here in the above example the value of operands x and y (which is 10 and 5) added by the + operator and total value 15 is assigned to a new variable z.<\/p>\n<p><span style=\"color: #993366;\"><strong>&#8211; (Subtraction Operator):<\/strong><\/span><\/p>\n<p>\u201c-\u201c is a binary operator which subtracts second operand from the first. Example of \u2013 operator:<\/p>\n<pre>int x = 10;\r\nint y = 5;\r\nint z = x \u2013 y;<\/pre>\n<p>In the above example value of y operands subtracts from x operands by \u2013 operator and result value is then assigned to new variable z.<\/p>\n<p><span style=\"color: #993366;\"><strong>\/ (Division Operator):<\/strong><\/span><\/p>\n<p>\/ is a binary operator which divide numerator by denominator. Example of division operator:<\/p>\n<pre>int x = 10;\r\nint y = 5;\r\nint z = x\/y;<\/pre>\n<p>In the above example, value of x is divided by y by \u201c\/\u201d operator and result value 2 is assigned to new variable z.<\/p>\n<p><span style=\"color: #993366;\"><strong>* (Multiplication Operator):<\/strong><\/span><\/p>\n<p>* is a binary operator which multiplies both the operands. Example of Multiplication operator:<\/p>\n<pre>int x = 10;\r\nint y = 5;\r\nint z = x*y;<\/pre>\n<p>In the above example, value of x and y operands is multiplied by \u201c*\u201d operator and result value 50 is assigned to z variable.<\/p>\n<p><span style=\"color: #993366;\"><strong>% (Remainder Or Modulos Operator):<\/strong><\/span><\/p>\n<p>% operator gives the remainder after an integer division of two operands. Example of remainder operator:<\/p>\n<pre>int x = 12;\r\nint y = 5;\r\nint z = x%y;<\/pre>\n<p>In the above example value % operator gives remainder of x and y division which is then assigned to new variable z. So the remainder value 2 is now stored in z variable.<\/p>\n<p><span style=\"text-decoration: underline; color: #008000;\"><strong>UNARY OPERATOR IN JAVA:<\/strong><\/span><\/p>\n<p>Unary Operator are second type of operator in JAVA which is created to work with only one operand performing operations like incrementing or decrementing the operand value by one, inverting a boolean value or negating an expression. There are total 5 different types of unary operator in JAVA namely +(Unary plus operator), -( Unary minus operator), ++( Increment operator),&#8211;( Decrement operator) and !( Logical complement operator).<\/p>\n<p><center><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-381\" src=\"\/java\/wp-content\/uploads\/2015\/12\/Unary-Operator-In-Java.jpg\" alt=\"Unary Operator In Java\" width=\"516\" height=\"295\" srcset=\"https:\/\/abhiandroid.com\/java\/wp-content\/uploads\/2015\/12\/Unary-Operator-In-Java.jpg 516w, https:\/\/abhiandroid.com\/java\/wp-content\/uploads\/2015\/12\/Unary-Operator-In-Java-300x172.jpg 300w\" sizes=\"auto, (max-width: 516px) 100vw, 516px\" \/><\/center>Now we will discuss each unary operator:<\/p>\n<p><span style=\"color: #993366;\"><strong>+(Unary plus operator):<\/strong><\/span><\/p>\n<p>This operator indicated positive value even though numbers are positive by default. Example of unary plus operator:<\/p>\n<pre>int x = +2;<\/pre>\n<p>In the above example value of x integer is positive 2.<\/p>\n<p><span style=\"color: #993366;\"><strong>-( Unary minus operator):<\/strong><\/span><\/p>\n<p>This operator negates an expression. Example of unary minus operator:<\/p>\n<pre>int x = -5;<\/pre>\n<p>In the above example the value of x is minus 5.<\/p>\n<p><span style=\"color: #993366;\"><strong>++( Increment operator):<\/strong><\/span><\/p>\n<p>This operator increment a value of operand by 1. Example of increment operator:<\/p>\n<pre>int x = 5;\r\nx++;<\/pre>\n<p>In the above example the value of x is incremented by 1 using ++ operator.<\/p>\n<p><span style=\"color: #993366;\"><strong>&#8211;(Decrement Operator):<\/strong><\/span><\/p>\n<p>This operator decrement the value of operand by 1. Example of decrement operator:<\/p>\n<pre>int x = 5;\r\nx--;<\/pre>\n<p>In the above example the value of x is decremented by 1 using &#8212; operator. The final value of x is 4.<\/p>\n<p><span style=\"color: #993366;\"><strong>!(Logical compliment Operator):<\/strong><\/span><\/p>\n<p>This operator inverts the value of a Boolean. Example of logical compliment operator:<\/p>\n<pre>bollean learningJava = true;\r\nSystem.out.println(!learningJava);<\/pre>\n<p>In the above result output will be false because of using logical compliment operator.<\/p>\n<p><span style=\"color: #008000;\"><strong><span style=\"text-decoration: underline;\">EQUALITY AND RELATIONAL OPERATOR:<\/span><\/strong><\/span><\/p>\n<p>Equality and relational can be considered as relationship operator because there work is to compare the first operand to the second operand testing the validity of the specified relationship between them. If the result is true then the result will be 1 otherwise for false result is 0. This operator are mostly used in conditions.<\/p>\n<p>There are 6 types of equality and relational operator in JAVA namely ==(Equal to), !=(not Equal to), &gt;(greater than), &lt; (less than), &gt;=(Greater than or equal to) and &lt;= (less than or equal to).<\/p>\n<p><center><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-382\" src=\"\/java\/wp-content\/uploads\/2015\/12\/Equality-And-Relational-Operator-In-Java.jpg\" alt=\"Equality And Relational Operator In Java\" width=\"514\" height=\"306\" srcset=\"https:\/\/abhiandroid.com\/java\/wp-content\/uploads\/2015\/12\/Equality-And-Relational-Operator-In-Java.jpg 514w, https:\/\/abhiandroid.com\/java\/wp-content\/uploads\/2015\/12\/Equality-And-Relational-Operator-In-Java-300x179.jpg 300w\" sizes=\"auto, (max-width: 514px) 100vw, 514px\" \/><\/center><span style=\"color: #993366;\"><strong>==(Equal to):<\/strong><\/span><\/p>\n<p>This operator checks the relationship of first operand is equal to second operand. Remember this operator is checking only if first operand is equal to second or not. It is not assigning value of second operand to first.<\/p>\n<p><span style=\"color: #ff0000;\"><strong>Important Note:<\/strong><\/span> Before we share example of equality and relational operator it is recommended to learn basics of if and else. Here we are only sharing basic and full separate guide will be shared in control flow statement topic.<\/p>\n<p>If and else is the most basic and easy to understand control flow statement which is why we are using them here. The function of \u201cif\u201d is to first check the particular test and if it is found to be true then only it allows the code inside it to execute otherwise skips it and moves to the else statement if present or move to code outside the if block. Also remember, if \u201cif\u201d statement is found to be true then it skips all else statement present just after it.<\/p>\n<p>Let us now create a simple equal to program:<\/p>\n<pre>int a = 5;\r\nint b = 7;\r\nif (a == b){\r\nSystem.out.println(\"a is equal to b\");\r\n}\r\nelse{\r\nSystem.out.println(\"a is not equal to b\");\r\n}<\/pre>\n<p>In the above case output will be \u201ca is not equal to b\u201d because a operand equality check with b comes out to be false. So statement\/code inside if is not executed and code inside else statement gets executed.<\/p>\n<p><span style=\"color: #993366;\"><strong>!=(Not equal to):<\/strong><\/span><\/p>\n<p>This operator checks the relationship of first operand is not equal to second operand. Let us now create a simple not equal to program:<\/p>\n<pre>int a = 5;\r\nint b = 7;\r\nif (a != b){\r\nSystem.out.println(\"a is not equal to b\");\r\n}\r\nelse{\r\nSystem.out.println(\"a is equal to b\");\r\n}<\/pre>\n<p>In the above case output will be \u201ca is not equal to b\u201d because a operand equality check with b comes out to be true. So statement\/code inside if gets executed.<\/p>\n<p><span style=\"color: #993366;\"><strong>&lt; (Less Than):<\/strong><\/span><\/p>\n<p>This operator checks first operand less than second operand. Example of less than operator:<\/p>\n<pre>int a = 5;\r\nint b = 7;\r\nif (a &lt; b)\r\n{ \r\n System.out.println(\"a is less than b\"); \r\n} else\r\n{ System.out.println(\"a is greater than or equal to b\"); \r\n}<\/pre>\n<p><span style=\"color: #993366;\"><strong>&gt; (Greater than):<\/strong><\/span><\/p>\n<p>This operator checks first operand is greater than second operand. Example of Greater than operator:<\/p>\n<pre>int a = 5;\r\nint b = 7;\r\nif (a &gt; b){\r\nSystem.out.println(\"a is greater than b\");\r\n}\r\nelse{\r\nSystem.out.println(\"a is less than or equal to b\");\r\n}<\/pre>\n<p>In the above case output will be \u201ca is less than or equal to b\u201d because the result of a operand greater than operator checks with b comes out to be false. So statement\/code inside if is skipped and else statement gets executed.<\/p>\n<p><span style=\"color: #993366;\"><strong> &lt;= (Lesser than or equal to):<\/strong><\/span><\/p>\n<p>This operator checks first operand is lesser than or equal to the second operand. Example of lesser than or equal to operator:<\/p>\n<pre>int a = 5;\r\nint b = 5;\r\nif (a &lt;= b)\r\n{\r\nSystem.out.println(\"a is either equal or lesser than b\"); \r\n} else{ \r\nSystem.out.println(\"a is greater than b\"); \r\n}<\/pre>\n<p>In the above case output will be &#8220;a is either equal or lesser than b&#8221; because the result of a operand lesser than or equal to operator checks with b comes out to be true. So statement\/code inside if is executed.<\/p>\n<p><span style=\"color: #993366;\"><strong>&gt;= (Greater than or equal to):<\/strong><\/span><\/p>\n<p>This operator checks whether first operand is greater than or equal to the second operand. Example of greater than or equal to operator:<\/p>\n<pre>int a = 7;\r\nint b = 5;\r\nif (a &gt;= b){\r\nSystem.out.println(\"a is either equal or greater than b\");\r\n}\r\nelse{\r\nSystem.out.println(\"a is lesser than b\");\r\n}<\/pre>\n<p>In the above case output will be &#8220;a is either equal or greater than b&#8221; because the result of a operand greater than or equal to operator checks with b comes out to be true. So statement\/code inside if is executed.<\/p>\n<p><span style=\"text-decoration: underline; color: #008000;\"><strong>CONDITIONAL OPERATOR:<\/strong><\/span><\/p>\n<p>Conditional Operator gives result based on evaluating two or more boolean expressions. There are three types of conditional operator in JAVA: &amp;&amp; (Conditional-AND), || (Conditional-OR) and ?: (Ternary). We will discuss all one by one:<\/p>\n<p><center><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-383\" src=\"\/java\/wp-content\/uploads\/2015\/12\/Conditional-Operator-In-Java.jpg\" alt=\"Conditional Operator In Java\" width=\"424\" height=\"228\" srcset=\"https:\/\/abhiandroid.com\/java\/wp-content\/uploads\/2015\/12\/Conditional-Operator-In-Java.jpg 424w, https:\/\/abhiandroid.com\/java\/wp-content\/uploads\/2015\/12\/Conditional-Operator-In-Java-300x161.jpg 300w\" sizes=\"auto, (max-width: 424px) 100vw, 424px\" \/><\/center><span style=\"color: #993366;\"><strong>&amp;&amp; (Conditional-AND) Operator:<\/strong><\/span><\/p>\n<p>Conditional AND operator takes two operands and both the operand has to be boolean expression (Expression whose output is either true or false). The &amp;&amp; operator return true only if both the operands are true otherwise it return false. In other words, if any one or both boolean expression is false, this operator will return false.<\/p>\n<p>Example of Conditional AND operator:<\/p>\n<p>Lets suppose we want to create a program which only accept people of age between 18 and 28:<\/p>\n<pre>int xAge = 25;\r\nif(xAge&gt;=18 &amp;&amp; xAge &lt;= 28 ){\r\nSystem.out.println(\"You are accepted\");\r\n}\r\nelse{\r\nSystem.out.println(\"Not accepted\");\r\n}<\/pre>\n<p>In the above example both the boolean expression are true so the logical AND(&amp;&amp;) operator will return true and thus the output will be You are accepted.<\/p>\n<p><span style=\"color: #993366;\"><strong>|| (Conditional-OR) Operator:<\/strong><\/span><\/p>\n<p>This operator also accept two operands and both the operands are boolean expression. The operator returns false if both the operand are false otherwise it return true. In other words, if any one boolean expression is true out of two, this operator will return true.<\/p>\n<p>Example of Conditional-OR Operator:<\/p>\n<p>Lets create a simple program where two types of peoples are accepted. Either whose age is less than 18 or greater than 28.<\/p>\n<pre>int xAge = 17;\r\nif(xAge &lt; 18 || xAge &gt; 28) {\r\nSystem.out.println(\"You are accepted\");\r\n}else\r\n{\r\nSystem.out.println(\"You are not accepted\");\r\n}<\/pre>\n<p>In the above example, since first boolean expression is true and we know if any boolean expression is true the logical OR operator will return true. Thus, output will be You are accepted.<\/p>\n<p><span style=\"color: #993366;\"><strong>?: (Ternary Operator):<\/strong><\/span><\/p>\n<p>Ternary Operator takes three operand in which first one is boolean expression, second and third operands are values. It is called ternary because it accepts three operands.<\/p>\n<p>In Ternary Operator, if the first operand which is boolean expression is true, then the value of second operand is return otherwise value of third operand is return. In other words, if boolean expression is false, the value of third operand will be return otherwise second operand will return.<\/p>\n<p><span style=\"color: #ff0000;\"><strong>Important Note:<\/strong><\/span> Ternary operator is a shorter sytax of if then else.<\/p>\n<p>Example of ternary operator:<br \/>\nLets create a program to know whether the number is even:<\/p>\n<pre>int x = 9;\r\nString output = (x%2 ==0): \"Even\" : \"Not even\";\r\nSystem.out.println(output);<\/pre>\n<p>If we divide 9 by 2 the remainder is 1 which is not equal to 0. So in the above example the first operand which is boolean expression is false. Thus the value of third operand is return and out is Not even.<\/p>\n<p><span style=\"color: #008000;\"><strong><span style=\"text-decoration: underline;\">TYPE COMPARISON OPERATOR:<\/span><\/strong><\/span><\/p>\n<p><span style=\"color: #993366;\"><strong>instanceof:<\/strong><\/span><\/p>\n<p>instanceof is also called type comparison operator. It compares an object to a specified type.<\/p>\n<p><span style=\"color: #ff0000;\"><strong>Important Note:<\/strong><\/span> Before you understand it, you must know What is Object, and Class in JAVA. Below we sharing only the basic of each topic:<\/p>\n<p>Object is any entity that has state &amp; behavior and class is a group of objects that has common properties. In other words Class is a blueprint or template from which objects are created. So objects are result(instance) of Class.<\/p>\n<p>instanceof operator is used to check whether the object is of particular class, subclass or interface type. It returns value true or false. If an object after comparison is find to be a specified type then it returns true otherwise false.<\/p>\n<p>instanceof work on IS~A principle. IS-A is a way of saying, &#8220;this object is a type of that class.&#8221;<\/p>\n<p><strong>Syntax of instanceof Operator:<\/strong><\/p>\n<pre>object instanceof type<\/pre>\n<p>It return true if object is of specified type as assigned on the right side. Example of instanceof Operator:<\/p>\n<pre>class Abhiandroid{\r\npublic static void main(String args[]){\r\nAbhiandroid uidesign =new Abhiandroid();\r\nSystem.out.println(uidesign instanceof Abhiandroid);\r\n}\r\n}<\/pre>\n<p>In the above example the output will be true since object uidesign is of Abhiandroid class type.<\/p>\n<p><span style=\"color: #ff0000;\"><strong>Important Note:<\/strong><\/span> If you found this instanceof operator confusing, we recommend you first understand the concept of class, object, OOPs concept, create few complex programs and comeback to this topic again. Then you will understand it more deeply and clearly.<\/p>\n<p><span style=\"text-decoration: underline;\"><span style=\"color: #008000;\"><strong>BITWISE AND BIT SHIFT OPERATOR:<\/strong><\/span><\/span><\/p>\n<p class=\"entry-title\"><span style=\"color: #993366;\"><strong>Bitwise Operator<\/strong><\/span><\/p>\n<p><span style=\"color: #ff0000;\"><strong>Important Note:<\/strong><\/span> Bitwise and Bit Shift Operator are hardly used in JAVA and very rarely used in Android. So you can ignore this operator.<\/p>\n<p>As from the name Bitwise sound these operator performs the operation on bit value. And also you must have heard bit is smallest unit of memory. <em>This is represented by either 0 or 1 which means you have only one option to mark your answer<\/em>. Also you can understand this concept by an electrical switch which is connected with a bulb. There can only be two conditions, one is bulb can be ON and second is it can be OFF. This is exact representation of a single bit. The combination of 4 bits is called as nibble. <strong>Bitwise common Operator are: Bitwise AND (&amp;), Bitwise OR(|) and Bitwise exclusive OR(^):<\/strong><\/p>\n<p>For complete information read <a href=\"\/java\/bitwise-operator-java-example.html\">Bitwise Tutorial with example<\/a>.<\/p>\n<p class=\"entry-title\"><span style=\"color: #993366;\"><strong>Shift: LeftShift And Rightshift Operator<\/strong><\/span><\/p>\n<p>Shift Operator is of two types Bitwise Left Shift And Right Shift operator. In the Bitwise shift operator, the result comes applying these operator on the bit values.<\/p>\n<p>For complete information read <a href=\"\/java\/shift-leftshift-and-rightshift-operator-in-java.html\">Shift: LeftShift And RightShift Tutorial with example<\/a>.<\/p>\n<hr \/>\n<h4><strong>Operator Precedence:<\/strong><\/h4>\n<p>So now you have learned all types of operator in JAVA. You now also know operator are special symbols in JAVA which perform specific operation to give specific result on operand which can be one, two or three. You now also know how to use this operand.<\/p>\n<p>But before you start using operator in JAVA you must also know one more concept called Operator Precedence. This operator precedence has all operator listed according to precedence order. Operator with higher precedence are executed first relative to the lower precedence operator.<\/p>\n<p>For example, suppose we are using two operator multiplication and addition, then according to operator precedence multiply will be evaluated first and then addition.<\/p>\n<pre>int x = 5*8+5;<\/pre>\n<p>Output will be 45 and not 65 because multiply operator(*) will be executed first relative to addition(+) operator.<\/p>\n<p><strong>Below is Operator Precedence Table:<\/strong><\/p>\n<table style=\"width: 100%;\" border=\"1\">\n<caption>Operator Precedence<\/caption>\n<tbody>\n<tr>\n<th>Operator<\/th>\n<th>Precedence<\/th>\n<\/tr>\n<tr>\n<td>postfix<\/td>\n<td>expr++, expr&#8211;<\/td>\n<\/tr>\n<tr>\n<td>unary<\/td>\n<td>++expr, &#8211;expr, +expr, -expr, ~, !<\/td>\n<\/tr>\n<tr>\n<td>multiplicative<\/td>\n<td>*, \/, %<\/td>\n<\/tr>\n<tr>\n<td>additive<\/td>\n<td>+, &#8211;<\/td>\n<\/tr>\n<tr>\n<td>shift<\/td>\n<td>&lt;&lt;, &gt;&gt;, &gt;&gt;&gt;<\/td>\n<\/tr>\n<tr>\n<td>relational<\/td>\n<td>&lt;, &gt;, &lt;=, &gt;=, instanceof<\/td>\n<\/tr>\n<tr>\n<td>equality<\/td>\n<td>==, !=<\/td>\n<\/tr>\n<tr>\n<td>bitwise AND<\/td>\n<td>&amp;<\/td>\n<\/tr>\n<tr>\n<td>bitwise exclusive OR<\/td>\n<td>^<\/td>\n<\/tr>\n<tr>\n<td>bitwise inclusive OR<\/td>\n<td>|<\/td>\n<\/tr>\n<tr>\n<td>logical AND<\/td>\n<td>&amp;&amp;<\/td>\n<\/tr>\n<tr>\n<td>logical OR<\/td>\n<td>||<\/td>\n<\/tr>\n<tr>\n<td>ternary<\/td>\n<td>? :<\/td>\n<\/tr>\n<tr>\n<td>assignment<\/td>\n<td>=, +=, -=, *=, \/=, %=, &amp;=, ^=, |=, &lt;&lt;=, &gt;&gt;=, &gt;&gt;&gt;=<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Operator at the top are have higher precedence and Operator on the same line have equal precedence. When operator of equal precedence appear in the same expression, a rule must govern which is evaluated first. All binary operator except for the assignment operator are evaluated from left to right; assignment operator are evaluated right to left.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In computer programming Operator is a symbol that tells the compiler to perform specific action which can be mathematical or logical. For example: \u2018+\u2019 is a additive operator which does addition of two number and can also be used for String concatenation. Lets take simple example to understand operator: int x = 4 + 5 &hellip; <a href=\"https:\/\/abhiandroid.com\/java\/operators-in-java\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Operator In JAVA With Examples<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"home.php","meta":{"footnotes":""},"class_list":["post-267","page","type-page","status-publish","hentry"],"psp_head":"<title>Operator In JAVA With Examples \u2013 Abhi Android<\/title>\r\n<meta name=\"description\" content=\"In computer programming Operator is a symbol that tells the compiler to perform specific action which can be mathematical or logical. For example: \u2018+\u2019 is a additive operator which does addition of two number and can also be used for String concatenation.\" \/>\r\n<meta name=\"robots\" content=\"index,follow\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/abhiandroid.com\/java\/operators-in-java\" \/>\r\n","_links":{"self":[{"href":"https:\/\/abhiandroid.com\/java\/wp-json\/wp\/v2\/pages\/267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/abhiandroid.com\/java\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/abhiandroid.com\/java\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/abhiandroid.com\/java\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/abhiandroid.com\/java\/wp-json\/wp\/v2\/comments?post=267"}],"version-history":[{"count":2,"href":"https:\/\/abhiandroid.com\/java\/wp-json\/wp\/v2\/pages\/267\/revisions"}],"predecessor-version":[{"id":1490,"href":"https:\/\/abhiandroid.com\/java\/wp-json\/wp\/v2\/pages\/267\/revisions\/1490"}],"wp:attachment":[{"href":"https:\/\/abhiandroid.com\/java\/wp-json\/wp\/v2\/media?parent=267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}