{"id":80817,"date":"2019-11-21T15:00:17","date_gmt":"2019-11-21T13:00:17","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=80817"},"modified":"2020-06-09T22:46:13","modified_gmt":"2020-06-09T19:46:13","slug":"basic-java-operators","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/","title":{"rendered":"Basic Java Operators"},"content":{"rendered":"<p>In this post, we feature a comprehensive article about the basic Java Operators. Basic Java operators are Arithmetic, Bitwise, Assignment, Relational,  Logical, Ternary, Unary, Shift, and Equality Operators. <\/p>\n<div class=\"toc\">\n<h3>Table Of Contents<\/h3>\n<dl>\n<dt><a href=\"#overview\">1. Overview<\/a><\/dt>\n<dt><a href=\"#basic\">2. Basic Java Operators<\/a><\/dt>\n<dd>\n<dl>\n<dt><a href=\"#prerequisites\">2.1. Prerequisites<\/a><\/dt>\n<dt><a href=\"#software\">2.2. Download<\/a><\/dt>\n<dt><a href=\"#setup\">2.3. Setup<\/a><\/dt>\n<dt><a href=\"#ide\">2.4. IDE<\/a><\/dt>\n<dt><a href=\"#arithmetic\">2.5. Arithmetic Operators<\/a><\/dt>\n<dt><a href=\"#bitwise\">2.6. Bitwise Operators<\/a><\/dt>\n<dt><a href=\"#assignment\">2.7. Assignment Operators<\/a><\/dt>\n<dt><a href=\"#relational\">2.8. Relational Operators<\/a><\/dt>\n<dt><a href=\"#logical\">2.9. Logical Operators<\/a><\/dt>\n<dt><a href=\"#ternary\">2.10. Ternary Operators<\/a><\/dt>\n<dt><a href=\"#unary\">2.11. Unary Operators<\/a><\/dt>\n<dt><a href=\"#shift\">2.12. BitShift Operators<\/a><\/dt>\n<dt><a href=\"#equality\">2.13. Instance of<\/a><\/dt>\n<dt><a href=\"#precedence\">2.14. Precedence Rules<\/a><\/dt>\n<\/dl>\n<\/dd>\n<dt><a href=\"#download\">3. Download the Source Code<\/a><\/dt>\n<\/dl>\n<\/div>\n<p>&nbsp;<\/p>\n<h2 class=\"wp-block-heading\">1. Overview<\/h2>\n<p>If you want to learn java, java operators are a great starting point. Java Operators are symbols that operate on one or more than one operand to give an output. Operators specify to the java interpreter to perform an operation. <\/p>\n<h2 class=\"wp-block-heading\"><a name=\"basic\"><\/a>2.  Java Operators<\/h2>\n<p>Java Operators are the symbols to perform an operation. They help the interpreter to execute the operation.  There are multiple type of operations in java. <\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"820\" height=\"634\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/java_operators.png\" alt=\"Java Operators\" class=\"wp-image-80979\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/java_operators.png 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/java_operators-300x232.png 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/java_operators-768x594.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Java Operators<\/figcaption><\/figure>\n<h3 class=\"wp-block-heading\"><a name=\"prerequisites\"><\/a>2.1 Prerequisites<\/h3>\n<p>Java 8 is required on the Linux, Windows or Mac operating system. Eclipse Oxygen can be used for this example. <\/p>\n<h3 class=\"wp-block-heading\"><a name=\"software\"><\/a>2.2 Download<\/h3>\n<p>You can download Java 8 from the Oracle web&nbsp;<a href=\"https:\/\/www.oracle.com\/technetwork\/java\/javase\/downloads\/jdk8-downloads-2133151.html\">site<\/a>&nbsp;. Eclipse Oxygen can be downloaded from the&nbsp;<a href=\"https:\/\/www.eclipsecon.org\/europe2019\/cfp\">eclipse web site<\/a>. <\/p>\n<h3 class=\"wp-block-heading\"><a name=\"setup\"><\/a>2.3 Setup<\/h3>\n<h4 class=\"wp-block-heading\">2.3.1 Java Setup<\/h4>\n<p>Below is the setup commands required for the Java Environment.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Setup<\/em><\/span><\/p>\n<pre class=\"brush:plain\">JAVA_HOME=\"\/desktop\/jdk1.8.0_73\"\nexport JAVA_HOME\nPATH=$JAVA_HOME\/bin:$PATH\nexport PATH\n<\/pre>\n<h3 class=\"wp-block-heading\"><a name=\"ide\"><\/a>2.4 IDE<\/h3>\n<h4 class=\"wp-block-heading\">2.4.1 Eclipse Oxygen Setup<\/h4>\n<p>The \u2018eclipse-java-oxygen-2-macosx-cocoa-x86_64.tar\u2019 can be downloaded from the eclipse website. The tar file is opened by double click. The tar file is unzipped by using the archive utility. After unzipping, you will find the eclipse icon in the folder. You can move the eclipse icon from the folder to applications by dragging the icon.<\/p>\n<h4 class=\"wp-block-heading\">2.4.2  Launching IDE<\/h4>\n<p>Eclipse has features related to language support, customization, and extension. You can click on the eclipse icon to launch eclipse. The eclipse screen pops up as shown in the screenshot below:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"842\" height=\"820\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/eclipse_launch_3.jpg.webp\" alt=\"Java Operators - Launching IDE\" class=\"wp-image-73863\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/eclipse_launch_3.jpg 842w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/eclipse_launch_3-300x292.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/eclipse_launch_3-768x748.jpg 768w\" sizes=\"(max-width: 842px) 100vw, 842px\" \/><figcaption>Launching IDE<\/figcaption><\/figure>\n<p>You can select the workspace from the screen which pops up. The attached image shows how it can be selected.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"820\" height=\"814\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/eclipse_workspace_3.jpg.webp\" alt=\"Java Operators - IntelliJ vs Eclipse\" class=\"wp-image-73867\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/eclipse_workspace_3.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/eclipse_workspace_3-150x150.jpg 150w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/eclipse_workspace_3-300x298.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/eclipse_workspace_3-768x762.jpg 768w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/eclipse_workspace_3-70x70.jpg 70w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Eclipse Workspace<\/figcaption><\/figure>\n<p>You can see the eclipse workbench on the screen. The attached screenshot shows the Eclipse project screen.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"820\" height=\"842\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/eclipse_launch_workspace-2.jpg.webp\" alt=\"Java Operators - Eclipse Workbench\" class=\"wp-image-73714\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/eclipse_launch_workspace-2.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/eclipse_launch_workspace-2-292x300.jpg 292w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/06\/eclipse_launch_workspace-2-768x789.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Eclipse Workbench<\/figcaption><\/figure>\n<p>Java&nbsp;<code>Hello World<\/code>&nbsp;class prints the greetings. The screenshot below is added to show the class and execution on the eclipse.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"820\" height=\"852\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/08\/java_hello.jpg\" alt=\"Java Operators - Java Hello\" class=\"wp-image-77007\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/08\/java_hello.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/08\/java_hello-289x300.jpg 289w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/08\/java_hello-768x798.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Java Hello<\/figcaption><\/figure>\n<h3 class=\"wp-block-heading\"><a name=\"arithmetic\"><\/a>2.5 Arithmetic Operators<\/h3>\n<p> Arithmetic operators are used to execute arithmetic operations on java primitive data types. The operators are listed below:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>* <\/strong>  (Multiplication)<\/li>\n<li><strong>\/ <\/strong>  (Division)<\/li>\n<li><strong>% &nbsp;<\/strong>(Modulus)<\/li>\n<li><strong>+  &nbsp;<\/strong>(Addition)<\/li>\n<li><strong>\u2013  &nbsp;<\/strong>(Subtraction)<\/li>\n<\/ul>\n<p>The code below shows the arithmetic operators specified above with examples.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Arithmetic Operators<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class ArithmeticOperators {\n\n\tpublic ArithmeticOperators() {\n\t\t\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tint g = 50, h = 70, i = 10, j = 90, k = 80, l = 60; \n        String u = \"You are\", v = \"Welcome\"; \n  \n         \n        System.out.println(\"g + h = \" + (g + h)); \n        System.out.println(\"g - h = \" + (g - h)); \n  \n         \n        System.out.println(\"u + v = \" + u + v); \n  \n        \n        System.out.println(\"g * h = \" + (g * h)); \n        System.out.println(\"g \/ h = \" + (g \/ h)); \n  \n        \n        System.out.println(\"g % h = \" + (g % h)); \n\n\t}\n\n}\n<\/pre>\n<p>The command below executes the above code snippet:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Run Command<\/em><\/span><\/p>\n<pre class=\"brush:plain\">javac ArithmeticOperations.java\njava ArithmeticOperations\n<\/pre>\n<p>The output of the executed command is shown below.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"820\" height=\"704\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/arithmetic.jpg\" alt=\"Java Operators - Arithmetic Operators\" class=\"wp-image-80947\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/arithmetic.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/arithmetic-300x258.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/arithmetic-768x659.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Arithmetic Operators<\/figcaption><\/figure>\n<h3 class=\"wp-block-heading\"><a name=\"bitwise\"><\/a>2.6 Bitwise Operators<\/h3>\n<p>Bitwise operators are used to execute operations on single bits. They can also be used with numbers of integer type.  Tree operations such as update and query use bitwise operators in a binary tree.  The bitwise operators are listed below:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>&amp;<\/strong> (AND operator)<strong> <\/strong>gives the result  AND of input bit values.<\/li>\n<li>| ( OR operator) gives the result OR of input bit values.<\/li>\n<li><strong>^<\/strong> ( XOR operator) gives the result XOR of input bit values.<\/li>\n<li><strong>~<\/strong> ( Complement Operator) gives the result of input bits reversed.<\/li>\n<\/ul>\n<p>The code below shows the Bitwise operators specified above with examples.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Bitwise Operators<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class BitwiseOperators {\n\n\tpublic BitwiseOperators() {\n\t\t\n\t}\n\n\tpublic static void main(String[] args) {\n        int cbit = 0x0004; \n        int dbit = 0x0003; \n  \n \n        System.out.println(\"cbit&amp;dbit = \" + (cbit &amp; dbit)); \n  \n        System.out.println(\"cbit|dbit = \" + (cbit | dbit)); \n  \n        System.out.println(\"cbit^dbit = \" + (cbit ^ dbit)); \n  \n        System.out.println(\"~cbit = \" + ~cbit); \n  \n        cbit &amp;= dbit; \n        System.out.println(\"cbit= \" + cbit); \n\n\t}\n\n}\n\n<\/pre>\n<p>The command below executes the above code snippet:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><span style=\"text-decoration: underline\"><em>Run Command<\/em><\/span><\/p>\n<pre class=\"brush:plain\">javac BitwiseOperators.java\njava BitwiseOperators\n<\/pre>\n<p>The output of the executed command is shown below.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"820\" height=\"709\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/bitwise.jpg\" alt=\"\" class=\"wp-image-80950\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/bitwise.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/bitwise-300x259.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/bitwise-768x664.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Bitwise Operations<\/figcaption><\/figure>\n<h3 class=\"wp-block-heading\"><a name=\"assignment\"><\/a>2.7   Assignment Operators<\/h3>\n<p>The assignment operator  is used to specify a value to the variable. The direction of the associativity is from right to left. The assignment operator is =.<\/p>\n<p>The code below shows the assignment operator specified above with examples.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Assignment Operators<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class AssignmentOperators {\n\n\tpublic AssignmentOperators() {\n\t\t\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tint h = 20, i = 10, j, k, l = 10, m = 4, n = 9; \n\t\t  \n        \n        j = i; \n        System.out.println(\"Value of j = \" + j); \n  \n        h = h + 1; \n        i = i - 1; \n        l = l * 2; \n        m = m \/ 2; \n        System.out.println(\"Sum of h,i,l,m = \" + h + \", \"\n                           + i + \", \" + l + \", \" + m); \n        h = h - 1; \n        i = i + 1; \n        l = l \/ 2; \n        m = m * 2; \n  \n        h += 1; \n        i -= 1; \n        l *= 2; \n        m \/= 2; \n        System.out.println(\"h,i,l,m (\"\n                           + \"applying shorthand operators)= \"\n                           + h + \", \" + i + \", \"\n                           + l + \", \" + m); \n\n\t}\n\n}\n\n<\/pre>\n<p>The command below executes the above code snippet:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Run Command<\/em><\/span><\/p>\n<pre class=\"brush:plain\">javac AssignmentOperators.java\njava AssignmentOperators\n<\/pre>\n<p>The output of the executed command is shown below.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"820\" height=\"696\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/assignment.jpg\" alt=\"\" class=\"wp-image-80953\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/assignment.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/assignment-300x255.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/assignment-768x652.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Assignment Operators<\/figcaption><\/figure>\n<h3 class=\"wp-block-heading\"><a name=\"relational\"><\/a>2.8  Relational  Operators<\/h3>\n<p>Relational operators are used to perform relational operations. The relational operations are equal to, not equal to, greater than, less than, less than equal to, and greater than equal to. These operators give a boolean result. These operations are used in looping and conditional statements. The relational operators are listed below:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>==<\/strong> (Equal to) gives a boolean result true if left-hand side value is equal to right-hand-side value.<\/li>\n<li><strong>!=<\/strong> (Not Equal to) gives a boolean result true if left-hand side value is not equal to right-hand-side value.<\/li>\n<li><strong>&lt;<\/strong> (less than)<strong> &nbsp;<\/strong>gives a boolean result true if left-hand side value is less than the right-hand side value.<\/li>\n<li><strong>&lt;=<\/strong> (less than or equal to )<strong>&nbsp;<\/strong>gives a boolean result true if left-hand side value is less than or equal to the right-hand side value.<\/li>\n<li><strong>&gt;<\/strong> (greater than  ) gives a boolean result true if left-hand side value is greater than the right-hand-side value.<\/li>\n<li><strong>&gt;=<\/strong> (greater than or equal to )<strong>&nbsp;<\/strong>gives a boolean result true if left-hand side value is greater than or equal to the right-hand side value.<\/li>\n<\/ul>\n<p>The code below shows the relational operators specified above with examples.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Relational Operators<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class RelationalOperators {\n\n\tpublic RelationalOperators() {\n\n\t}\n\n\tpublic static void main(String[] args) {\n        int c = 30, d = 20; \n        String u = \"Welcome\", v = \"Welcome\"; \n        int array1[] = { 1, 2, 3 }; \n        int array2[] = { 1, 2, 3 }; \n        boolean condvar = true; \n  \n        \n        System.out.println(\"c == d :\" + (c == d)); \n        System.out.println(\"c &lt; d :\" + (c &lt; d)); \n        System.out.println(\"c &lt;= d :\" + (c  d :\" + (c &gt; d)); \n        System.out.println(\"c &gt;= d :\" + (c &gt;= d)); \n        System.out.println(\"c != d :\" + (c != d)); \n  \n        System.out.println(\"u == v : \" + (u == v)); \n        System.out.println(\"array1 == array2 : \" + (array1 == array2)); \n  \n        System.out.println(\"condvar==true :\"\n                           + (condvar == true)); \n\n\t}\n\n}\n\n<\/pre>\n<p>The command below executes the above code snippet:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Run Command<\/em><\/span><\/p>\n<pre class=\"brush:plain\">javac RelationalOperators.java\njava RelationalOperators\n<\/pre>\n<p>The output of the executed command is shown below.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"820\" height=\"695\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/relational.jpg\" alt=\"\" class=\"wp-image-80959\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/relational.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/relational-300x254.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/relational-768x651.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Relational Operators<\/figcaption><\/figure>\n<h3 class=\"wp-block-heading\"><a name=\"logical\"><\/a>2.9  Logical  Operators in Java<\/h3>\n<p>Logical operators are used to execute logical operations such as AND and OR operations. These operations are based on digital gate operations. Given two conditions, the second condition is not executed during the operation if the first condition is false in the case of AND operation.  These operators are listed below:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>&amp;&amp;<\/strong>  (AND) gives a boolean result true when both conditions are true.<\/li>\n<li><strong>||<\/strong> (OR)<strong> <\/strong>gives a boolean result true if at least one condition is true.<\/li>\n<\/ul>\n<p>The code below shows the logical operator (&amp;&amp;)  in a Java example.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Logical Operators<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class LogicalOperators {\n\n\tpublic LogicalOperators() {\n\t\t\n\t}\n\t\n\t\n\tpublic boolean login(String username, String password, String u, String v)\n\t{\n        if ((username.equals(u) &amp;&amp; password.equals(v)) \n                || (username.equals(v) &amp;&amp; password.equals(u))) { \n                return true;\n            } \n            else { \n                return false; \n            } \n   \n\t}\n\t\n\tpublic void printMessage(boolean check)\n\t{\n\t\t if(check)\n\t        {\n\t          System.out.println(\"User is authenticated\"); \n\t        }\n\t        else\n\t        {\n\t        \t  System.out.println(\"Wrong uid or password\"); \n\t        }\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tString u = \"thomas\"; \n        String v = \"password\"; \n  \n        LogicalOperators logic = new LogicalOperators();\n        \n         \n        String username = \"thomas\"; \n \n        String password = \"password\"; \n   \n        boolean check = logic.login(username, password, u, v);\n        \n        \n        System.out.println(\"user\"+username);\n        \n        logic.printMessage(check) ;\n        \n        username = \"william\";\n        \n        password = \"passwo1d\";\n        \n        check = logic.login(username, password, u, v);\n         \n        System.out.println(\"user\"+username);\n        \n        logic.printMessage(check) ;\n\n\t}\n\n}\n\n<\/pre>\n<p>The command below executes the above code snippet related to the logical operator in Java:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Run Command<\/em><\/span><\/p>\n<pre class=\"brush:plain\">javac  LogicalOperators.java\njava  LogicalOperators\n<\/pre>\n<p>The output of the executed command is shown below.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"820\" height=\"686\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/logical.jpg\" alt=\"\" class=\"wp-image-80961\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/logical.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/logical-300x251.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/logical-768x642.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Logical Operators<\/figcaption><\/figure>\n<h3 class=\"wp-block-heading\"><a name=\"ternary\"><\/a>2.10  Ternary Operators<\/h3>\n<p>Ternary operators are related to the if-else statement. It consists of three operands. Ternary refers to three operators.  The operator format is typically  like  &#8216;condition ? if  condition is true : if  condition isfalse &#8216;<\/p>\n<p>The code below shows the ternary operator example.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Ternary Operators<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class TernaryOperators {\n\n\tpublic TernaryOperators() {\n\t\t\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tint d = 40, e = 20, f = 50, output; \n\t\t  \n\n        output = ((d &gt; e) \n                      ? (d &gt; f) \n                            ? d \n                            : f \n                      : (e &gt; f) \n                            ? e \n                            : f); \n        System.out.println(\"Maximum of three given numbers is \"\n                           + output); \n\n\t}\n\n}\n\n<\/pre>\n<p>The command below executes the above code snippet:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Run Command<\/em><\/span><\/p>\n<pre class=\"brush:plain\">javac TernaryOperators.java\njava TernaryOperators\n<\/pre>\n<p>The output of the executed command is shown below.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"820\" height=\"691\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/ternary.jpg\" alt=\"\" class=\"wp-image-80963\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/ternary.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/ternary-300x253.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/ternary-768x647.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Ternary Operators<\/figcaption><\/figure>\n<h3 class=\"wp-block-heading\"><a name=\"unary\"><\/a>2.11   Unary Operators<\/h3>\n<p>Unary operators have one operand. The operators are used for incrementing, decrementing, and negating the value. The operators are listed below:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>\u2013 <\/strong>(Unary minus) negates the input values.<\/li>\n<li><strong>+ <\/strong>(Unary plus) converts the input value to positive<\/li>\n<li><strong>++ <\/strong>(Increment) increments the input value by 1. Post Increment does increment after calculating the result. Pre-Increment increments first and then it computes the result. <\/li>\n<li><strong>\u2014 <\/strong>(Decrement) decrements the input value by 1. Post decrement does decrement after calculating the result. Pre-decrement decrements first and then it computes the result. <\/li>\n<li><strong>! <\/strong>(Logical not) inverts the input value<\/li>\n<\/ul>\n<p>The code below shows the unary operators specified above with examples.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Arithmetic Operators<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class UnaryOperators {\n\n\tpublic UnaryOperators() {\n\t\t\/\/ TODO Auto-generated constructor stub\n\t}\n\n\tpublic static void main(String[] args) {\n\t\t int g = 40, h = 14, i = 21, j = 33, k = 87, l = 56; \n\t        boolean condvar = true; \n\t  \n\n\t        i = ++g; \n\t        System.out.println(\"Value of i (++g) = \" + i); \n\t  \n\n\t        i = h++; \n\t        System.out.println(\"Value of i (h++) = \" + i); \n\t  \n\t        i = --j; \n\t        System.out.println(\"Value of i (--j) = \" + i); \n\t  \n\t        i = k--; \n\t        System.out.println(\"Value of i (k--) = \" + i); \n\t  \n\t        System.out.println(\"Value of !condvar =\"\n\t                           + !condvar); \n\n\t}\n\n}\n\n<\/pre>\n<p>The command below executes the above code snippet:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Run Command<\/em><\/span><\/p>\n<pre class=\"brush:plain\">javac UnaryOperators.java\njava UnaryOperators\n<\/pre>\n<p>The output of the executed command is shown below.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"820\" height=\"689\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/unary.jpg\" alt=\"\" class=\"wp-image-80965\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/unary.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/unary-300x252.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/unary-768x645.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Unary Operators<\/figcaption><\/figure>\n<h3 class=\"wp-block-heading\"><a name=\"shift\"><\/a>2.12   BitShift Operators<\/h3>\n<p>BitShift operators perform shift (left or right) operations on the bits. They are used for multiplying or dividing the input value by a number which is a power of two. The shift operators are :<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>&lt;&lt; <\/strong>(Left shift operator) performs the left shift on the bit. If the input is void, the result will be 0. It is used for multiplying the input value by a number which is a power of two.<\/li>\n<li><strong>&gt;&gt;<\/strong>(Signed Right shift operator) performs the right shift on the bit. If the input is void, the result will be 0. It is used for dividing the input value by a number which is a power of two.<\/li>\n<li>&gt;&gt;&gt; (UnSigned Right shift operator) performs the right shift on the bit. If the input is void, the result will be 0. The leftmost bit is set to zero value.<\/li>\n<\/ul>\n<p>The code below shows the bitshift operators specified above with examples.<\/p>\n<p><span style=\"text-decoration: underline\"><em>BitShift Operators<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class BitShiftOperators {\n\n\tpublic BitShiftOperators() {\n\t\t\n\t}\n\n\tpublic static void main(String[] args) {\n        int c = 0x0003; \n        int d = -30; \n  \n       \n        System.out.println(\"c&lt;&lt;2 = \" + (c &lt;&lt; 2)); \n  \n       \n        System.out.println(\"c&gt;&gt;2 = \" + (c &gt;&gt; 2)); \n  \n       \n        System.out.println(\"d&gt;&gt;&gt;2 = \" + (d &gt;&gt;&gt; 2)); \n\n\t}\n\n}\n<\/pre>\n<p>The command below executes the above code snippet:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Run Command<\/em><\/span><\/p>\n<pre class=\"brush:plain\">javac BitShiftOperators.java\njava BitShiftOperators\n<\/pre>\n<p>The output of the executed command is shown below.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"820\" height=\"689\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/bitshift.jpg\" alt=\"\" class=\"wp-image-80968\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/bitshift.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/bitshift-300x252.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/bitshift-768x645.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>BitShift Operators<\/figcaption><\/figure>\n<h3 class=\"wp-block-heading\"><a name=\"equality\"><\/a>2.13  Instance Of<\/h3>\n<p>The instanceof operator takes the input object and checks the object type to a specified type. It is used for checking if the input object is an instance of a class,  subclass, and an instance of a class that implements an interface.<\/p>\n<p>The code below shows the instance of operator specified above with examples.<\/p>\n<p><span style=\"text-decoration: underline\"><em>InstanceOf Operators<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class InstanceOfOperators {\n\n\tpublic InstanceOfOperators() {\n\t\t\/\/ TODO Auto-generated constructor stub\n\t}\n\n    public static void main(String[] args) \n    { \n  \n        Employee employee = new Employee(); \n        Employee manager = new Manager(); \n  \n        System.out.println(\"employee instanceof Employee: \"\n                           + (employee instanceof Employee)); \n        System.out.println(\"employee instanceof Manager: \"\n                           + (employee instanceof Manager)); \n        System.out.println(\"employee instanceof Delegate: \"\n                           + (employee instanceof Delegate)); \n  \n\n        System.out.println(\"manager instanceof Employee: \"\n                           + (manager instanceof Employee)); \n        System.out.println(\"manager instanceof Manager: \"\n                           + (manager instanceof Manager)); \n        System.out.println(\"manager instanceof Delegate: \"\n                           + (manager instanceof Delegate)); \n    } \n} \n  \nclass Employee { \n} \n  \nclass Manager extends Employee implements Delegate { \n} \n  \ninterface Delegate { \n}\n\n<\/pre>\n<p>The command below executes the above code snippet:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Run Command<\/em><\/span><\/p>\n<pre class=\"brush:plain\">javac InstanceOfOperators.java\njava InstanceOfOperators\n<\/pre>\n<p>The output of the executed command is shown below.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"820\" height=\"691\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/instanceof.jpg\" alt=\"\" class=\"wp-image-80971\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/instanceof.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/instanceof-300x253.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/instanceof-768x647.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Instance Of Operators<\/figcaption><\/figure>\n<h3 class=\"wp-block-heading\"><a name=\"precedence\"><\/a>2.14 Precedence Rules   <\/h3>\n<p>Precedence and associativity rules are applied if there are multiple operators. The rules help in finding which operators need to be executed before the other. The operators  are listed below:<\/p>\n<figure class=\"wp-block-table is-style-stripes\">\n<table class=\"has-subtle-pale-green-background-color has-background\">\n<tbody>\n<tr>\n<td><strong>Operator<\/strong><\/td>\n<td><strong>Precedence Rule<\/strong><\/td>\n<td><strong>Associativity<\/strong><\/td>\n<\/tr>\n<tr>\n<td>postfix<\/td>\n<td>++,&#8211;<\/td>\n<td>right to left<\/td>\n<\/tr>\n<tr>\n<td>unary<\/td>\n<td>++, &#8211;,+,-,~,!<\/td>\n<td>right to left<\/td>\n<\/tr>\n<tr>\n<td>multiplication, division, modulus<\/td>\n<td>*, \/, %<\/td>\n<td>left to right<\/td>\n<\/tr>\n<tr>\n<td>addition<\/td>\n<td>+,-<\/td>\n<td>left to right<\/td>\n<\/tr>\n<tr>\n<td>shift<\/td>\n<td>&lt;&lt;, &gt;&gt;, &gt;&gt;&gt;<\/td>\n<td>left to right<\/td>\n<\/tr>\n<tr>\n<td>relational<\/td>\n<td>&lt;, &gt;, &lt;=, &gt;=, instanceof<\/td>\n<td>left to right<\/td>\n<\/tr>\n<tr>\n<td>equal<\/td>\n<td>==, !=<\/td>\n<td>left to right<\/td>\n<\/tr>\n<tr>\n<td>AND (bitwise)<\/td>\n<td>&amp;<\/td>\n<td>left to right<\/td>\n<\/tr>\n<tr>\n<td>Exclusive OR<\/td>\n<td>^<\/td>\n<td>left to right<\/td>\n<\/tr>\n<tr>\n<td>Inclusive OR<\/td>\n<td>|<\/td>\n<td>left to right<\/td>\n<\/tr>\n<tr>\n<td>AND<\/td>\n<td>&amp;&amp;<\/td>\n<td>left to right<\/td>\n<\/tr>\n<tr>\n<td>OR<\/td>\n<td>||<\/td>\n<td>left to right<\/td>\n<\/tr>\n<tr>\n<td>ternary<\/td>\n<td>?, :<\/td>\n<td>right to left<\/td>\n<\/tr>\n<tr>\n<td>assignment<\/td>\n<td>= , +=<\/td>\n<td>right to left<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p>The operators are mentioned in the table above in the precedence order. Precedence is higher if the operator is at the top. Operators with higher precedence are executed first and then the operators with lower precedence. Operators in a row have equal precedence value. When operators have equal in an expression,  the binary operators are executed from left to right and then the assignment operators from right to left.<\/p>\n<p>The code below shows the precedence rules specified above with examples.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Precedence Rules<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class PrecedenceRules {\n\n\tpublic PrecedenceRules() {\n\n\t}\n\n\tpublic static void main(String[] args) {\n\t\t int g = 31, h = 43, i = 4, j = 54, k = 87, l = 98; \n\t\t  \n \n\t        System.out.println(\"g+h\/j = \" + (g + h \/ j)); \n\t  \n\n\t        System.out.println(\"g+h*j-k\/l = \"\n\t                           + (g + h * j - k \/ l)); \n\n\t}\n\n}\n\n<\/pre>\n<p>The command below executes the above code snippet:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Run Command<\/em><\/span><\/p>\n<pre class=\"brush:plain\">javac PrecedenceRules.java\njava PrecedenceRules\n<\/pre>\n<p>The output of the executed command is shown below.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"820\" height=\"693\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/precedencerules.jpg\" alt=\"\" class=\"wp-image-80974\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/precedencerules.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/precedencerules-300x254.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/precedencerules-768x649.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Precedence Rules<\/figcaption><\/figure>\n<h2 class=\"wp-block-heading\">3. Download the Source Code<\/h2>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/11\/Java_Operators.zip\"><strong>Basic Java Operators<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this post, we feature a comprehensive article about the basic Java Operators. Basic Java operators are Arithmetic, Bitwise, Assignment, Relational, Logical, Ternary, Unary, Shift, and Equality Operators. Table Of Contents 1. Overview 2. Basic Java Operators 2.1. Prerequisites 2.2. Download 2.3. Setup 2.4. IDE 2.5. Arithmetic Operators 2.6. Bitwise Operators 2.7. Assignment Operators 2.8. &hellip;<\/p>\n","protected":false},"author":31,"featured_media":1204,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[478],"class_list":["post-80817","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-core-java","tag-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Basic Java Operators - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Check out our article about the basic Java Operators: Arithmetic, Bitwise, Assignment, Relational, Logical, Ternary, Unary, Shift, and Equality Operators.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Basic Java Operators - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Check out our article about the basic Java Operators: Arithmetic, Bitwise, Assignment, Relational, Logical, Ternary, Unary, Shift, and Equality Operators.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/bhagvank\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-21T13:00:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-06-09T19:46:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Bhagvan Kommadi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bhaggu\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bhagvan Kommadi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/\"},\"author\":{\"name\":\"Bhagvan Kommadi\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/4575ae335b8ff016be62c3b927d5d5e6\"},\"headline\":\"Basic Java Operators\",\"datePublished\":\"2019-11-21T13:00:17+00:00\",\"dateModified\":\"2020-06-09T19:46:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/\"},\"wordCount\":1611,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"keywords\":[\"Java\"],\"articleSection\":[\"Core Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/\",\"name\":\"Basic Java Operators - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"datePublished\":\"2019-11-21T13:00:17+00:00\",\"dateModified\":\"2020-06-09T19:46:13+00:00\",\"description\":\"Check out our article about the basic Java Operators: Arithmetic, Bitwise, Assignment, Relational, Logical, Ternary, Unary, Shift, and Equality Operators.\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"Bipartite Graph\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Core Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Basic Java Operators\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/4575ae335b8ff016be62c3b927d5d5e6\",\"name\":\"Bhagvan Kommadi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/02\/bhagvan.-kommadi-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/02\/bhagvan.-kommadi-96x96.jpg\",\"caption\":\"Bhagvan Kommadi\"},\"description\":\"Bhagvan Kommadi is the Founder of Architect Corner &amp; has around 20 years\u2019 experience in the industry, ranging from large scale enterprise development to helping incubate software product start-ups. He has done Masters in Industrial Systems Engineering at Georgia Institute of Technology (1997) and Bachelors in Aerospace Engineering from Indian Institute of Technology, Madras (1993). He is member of IFX forum,Oracle JCP and participant in Java Community Process. He founded Quantica Computacao, the first quantum computing startup in India. Markets and Markets have positioned Quantica Computacao in \u2018Emerging Companies\u2019 section of Quantum Computing quadrants. Bhagvan has engineered and developed simulators and tools in the area of quantum technology using IBM Q, Microsoft Q# and Google QScript. He has reviewed the Manning book titled : \\\"Machine Learning with TensorFlow\u201d. He is also the author of Packt Publishing book - \\\"Hands-On Data Structures and Algorithms with Go\\\".He is member of IFX forum,Oracle JCP and participant in Java Community Process. He is member of the MIT Technology Review Global Panel.\",\"sameAs\":[\"http:\/\/www.architectcorner.com\",\"https:\/\/www.facebook.com\/bhagvank\",\"https:\/\/in.linkedin.com\/pub\/bhagvan-kommadi\/0\/3a6\/b46\",\"https:\/\/x.com\/bhaggu\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/bhagvan-kommadi\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Basic Java Operators - Java Code Geeks","description":"Check out our article about the basic Java Operators: Arithmetic, Bitwise, Assignment, Relational, Logical, Ternary, Unary, Shift, and Equality Operators.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/","og_locale":"en_US","og_type":"article","og_title":"Basic Java Operators - Java Code Geeks","og_description":"Check out our article about the basic Java Operators: Arithmetic, Bitwise, Assignment, Relational, Logical, Ternary, Unary, Shift, and Equality Operators.","og_url":"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_author":"https:\/\/www.facebook.com\/bhagvank","article_published_time":"2019-11-21T13:00:17+00:00","article_modified_time":"2020-06-09T19:46:13+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","type":"image\/jpeg"}],"author":"Bhagvan Kommadi","twitter_card":"summary_large_image","twitter_creator":"@bhaggu","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Bhagvan Kommadi","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/"},"author":{"name":"Bhagvan Kommadi","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/4575ae335b8ff016be62c3b927d5d5e6"},"headline":"Basic Java Operators","datePublished":"2019-11-21T13:00:17+00:00","dateModified":"2020-06-09T19:46:13+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/"},"wordCount":1611,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","keywords":["Java"],"articleSection":["Core Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/basic-java-operators\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/","url":"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/","name":"Basic Java Operators - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","datePublished":"2019-11-21T13:00:17+00:00","dateModified":"2020-06-09T19:46:13+00:00","description":"Check out our article about the basic Java Operators: Arithmetic, Bitwise, Assignment, Relational, Logical, Ternary, Unary, Shift, and Equality Operators.","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/basic-java-operators\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","width":150,"height":150,"caption":"Bipartite Graph"},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Core Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/"},{"@type":"ListItem","position":4,"name":"Basic Java Operators"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/4575ae335b8ff016be62c3b927d5d5e6","name":"Bhagvan Kommadi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/02\/bhagvan.-kommadi-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/02\/bhagvan.-kommadi-96x96.jpg","caption":"Bhagvan Kommadi"},"description":"Bhagvan Kommadi is the Founder of Architect Corner &amp; has around 20 years\u2019 experience in the industry, ranging from large scale enterprise development to helping incubate software product start-ups. He has done Masters in Industrial Systems Engineering at Georgia Institute of Technology (1997) and Bachelors in Aerospace Engineering from Indian Institute of Technology, Madras (1993). He is member of IFX forum,Oracle JCP and participant in Java Community Process. He founded Quantica Computacao, the first quantum computing startup in India. Markets and Markets have positioned Quantica Computacao in \u2018Emerging Companies\u2019 section of Quantum Computing quadrants. Bhagvan has engineered and developed simulators and tools in the area of quantum technology using IBM Q, Microsoft Q# and Google QScript. He has reviewed the Manning book titled : \"Machine Learning with TensorFlow\u201d. He is also the author of Packt Publishing book - \"Hands-On Data Structures and Algorithms with Go\".He is member of IFX forum,Oracle JCP and participant in Java Community Process. He is member of the MIT Technology Review Global Panel.","sameAs":["http:\/\/www.architectcorner.com","https:\/\/www.facebook.com\/bhagvank","https:\/\/in.linkedin.com\/pub\/bhagvan-kommadi\/0\/3a6\/b46","https:\/\/x.com\/bhaggu"],"url":"https:\/\/examples.javacodegeeks.com\/author\/bhagvan-kommadi\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/80817","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=80817"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/80817\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1204"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=80817"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=80817"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=80817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}