<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Java HowTo Guide &#187; Operator</title>
	<atom:link href="http://www.javahowtoguide.com/category/java-basics/operator/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.javahowtoguide.com</link>
	<description>Learn JAVA with US</description>
	<lastBuildDate>Tue, 20 Dec 2011 10:10:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>JAVA &#8211; Logical /Boolean Operator</title>
		<link>http://www.javahowtoguide.com/java-logical-boolean-operator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=java-logical-boolean-operator</link>
		<comments>http://www.javahowtoguide.com/java-logical-boolean-operator/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 13:18:29 +0000</pubDate>
		<dc:creator>Java Tutor</dc:creator>
				<category><![CDATA[Operator]]></category>
		<category><![CDATA[Logical /Boolean Operator in JAVA]]></category>

		<guid isPermaLink="false">http://www.javahowtoguide.com/?p=69</guid>
		<description><![CDATA[ <p> </p> <p> </p> <p>The relational operators work well in conditions where only a single condition needs to be checked. Logical operators either return a True value or a False value based on the state of the Variables. The six logical or Boolean, operators used in the Java programming language are:</p> AND conditional AND OR conditional OR exclusive OR NOT <p>A logical operator accepts only arguments declared as Boolean data types. Also, these operators return value of Boolean data type.</p> <p>These operators unlike the relational operators, that you already know, are used to check whether a set of conditions is true or not. In such as case, if statements are used. The code snippet below shows example of this:</p> if (num_var_1 == 4) {   if (num_var_2 != 4) {      System.out.println("Both conditions are true.");    } } <p>However, as you can see this is not a user-friendly code, and is both harder to write and read. Such a code snippet becomes difficult to manage when multiple conditions are used. Let’s now look at the use of the following three conditional operators:&#38;&#38;, &#124;&#124; and !.</p> <p>The logical operator &#38;&#38; combines two Boolean values and gives a True result if and only if both of its operands are true. This is shown in the following code snippet:</p> Boolean c; num_var_1 = 51 &#62; 49 &#38;&#38; 13 &#60; 13; // num_var_1 is true num_var_1 = 44 &#62; 52 &#38;&#38; 7 &#60; 9; // num_var_1 is now false <p>Similarly, the logical operator &#124;&#124; combines two Boolean variables or expressions. It returns a true result only if either or both of its operands are true. Let’s look at the following code snippet which shows the rule:</p> Boolean d; num_var_4 = 51 &#62; 49 &#124;&#124; 73 &#60; 91; // num_var_4 is true num_var_4 = <p>Continue reading <a href="http://www.javahowtoguide.com/java-logical-boolean-operator/">JAVA &#8211; Logical /Boolean Operator</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong><br />
</strong><strong> </strong></p>
<p><strong> </strong></p>
<p>The relational operators work well in conditions where only a single condition needs to be checked. Logical operators either return a True value or a False value based on the state of the Variables. The six logical or Boolean, operators used in the Java programming language are:</p>
<ul>
<li>AND</li>
<li>conditional AND</li>
<li>OR</li>
<li>conditional OR</li>
<li>exclusive OR</li>
<li>NOT</li>
</ul>
<p>A logical operator accepts only arguments declared as Boolean data types. Also, these operators return value of Boolean data type.</p>
<p>These operators unlike the relational operators, that you already know, are used to check whether a set of conditions is true or not. In such as case, if statements are used. The code snippet below shows example of this:</p>
<pre><code>if (num_var_1 == 4) {</code></pre>
<pre><code>  if (num_var_2 != 4) {</code></pre>
<pre><code>     System.out.println("Both conditions are true.");</code></pre>
<pre><code>   }</code></pre>
<pre><code>}</code></pre>
<p>However, as you can see this is not a user-friendly code, and is both harder to write and read. Such a code snippet becomes difficult to manage when multiple conditions are used. Let’s now look at the use of the following three conditional operators:<code>&amp;&amp;</code>, <code>||</code> and <code>!</code>.</p>
<p><code>The logical operator &amp;&amp; combines two Boolean values and gives a True result </code>if and only if both of its operands are true. This is shown in the following code snippet:</p>
<pre><code>Boolean c;</code></pre>
<pre><code>num_var_1 = 51 &gt; 49 &amp;&amp; 13 &lt; 13; // num_var_1 is true</code></pre>
<pre><code>num_var_1 = 44 &gt; 52 &amp;&amp; 7 &lt; 9; // num_var_1 is now false</code></pre>
<p><code>Similarly, the logical operator <strong>||</strong></code> combines two Boolean variables or expressions. It returns a true result only if either or both of its operands are true. Let’s look at the following code snippet which shows the rule:</p>
<pre><code>Boolean d;</code></pre>
<pre><code>num_var_4 = 51 &gt; 49 || 73 &lt; 91; // num_var_4 is true</code></pre>
<pre><code>num_var_4 = 49 &gt; 51 || 73 &lt; 91; // num_var_4 is still true</code></pre>
<pre><code>num_var_4 = 49 &gt; 51 || 73 &gt; 91; // now num_var_4 is false</code></pre>
<p>The third and the last logic operator which we will look at is “!”  Which denotes “<strong>not”</strong>. The “!” logical operator reverses the value of a Boolean expression.</p>
<p>According to this logical operator:</p>
<p>if <code>x</code> is true <code>!x</code> is false.</p>
<p>If <code>x </code>is false  !x is true.</p>
<pre><code>boolean bol_var_1;</code></pre>
<pre><code>bol_var_1 = !(4 &gt; 5); // bol_var_1 is false</code></pre>
<pre><code>bol_var_1 = !(5 &gt; 4); // bol_var_1 is true</code></pre>
<p>As already stated logical operators allow you to test and use multiple conditions. For example, we can use the logical operators in the code snippet we saw above as follows:</p>
<pre><code>if (var_num_1 == 2 &amp;&amp; var_num_2 != 2) {</code></pre>
<pre><code>  System.out.println("Both conditions are true.");</code></pre>
<pre><code>}</code></pre>
<p>Let’s look at a code snippet Demo_of_Logical_Operators which makes use of multiple logical operators:</p>
<p>public class Demo_of_Logical_Operators</p>
<p>{</p>
<p>public Demo_of_Logical_Operators () {</p>
<p>boolean bol_var_1 = true;</p>
<p>boolean bol_var_2 = false;</p>
<p>System.out.println(&#8220;bol_var_1 &amp; bol_var_2 : &#8221; + (bol_var_1 &amp; bol_var_2));</p>
<p>System.out.println(&#8220;bol_var_1 &amp;&amp; bol_var_2 : &#8221; + (bol_var_1 &amp;&amp; bol_var_2));</p>
<p>System.out.println(&#8220;bol_var_1 | bol_var_2 : &#8221; + (bol_var_1 | bol_var_2));</p>
<p>System.out.println(&#8220;bol_var_1 || bol_var_2: &#8221; + (bol_var_1 || bol_var_2));</p>
<p>System.out.println(&#8220;bol_var_1 ^ bol_var_2 : &#8221; + (bol_var_1 ^ bol_var_2));</p>
<p>System.out.println(&#8220;!bol_var_1 : &#8221; + (!bol_var_1));</p>
<p>}</p>
<p>public static void main(String args[]) {</p>
<p>new Demo_of_Logical_Operators ();</p>
<p>The table given below defines the different Boolean operators, if x and y are both Boolean expressions.</p>
<table border="1" cellspacing="0" cellpadding="0" width="508">
<tbody>
<tr>
<td width="80" valign="top"><strong>x</strong><strong> </strong></td>
<td width="80" valign="top"><strong>y</strong><strong> </strong></td>
<td width="80" valign="top"><strong>!x </strong></td>
<td width="100" valign="top"><strong>x &amp;   y </strong></p>
<p><strong>x   &amp;&amp; y</strong></td>
<td width="100" valign="top"><strong>x | y </strong></p>
<p><strong>x || y </strong></td>
<td width="68" valign="top"><strong>x ^ y </strong></td>
</tr>
<tr>
<td valign="top">true</td>
<td valign="top">true</td>
<td valign="top">false</td>
<td valign="top">true</td>
<td valign="top">true</td>
<td valign="top">false</td>
</tr>
<tr>
<td valign="top">true</td>
<td valign="top">false</td>
<td valign="top">false</td>
<td valign="top">false</td>
<td valign="top">true</td>
<td valign="top">true</td>
</tr>
<tr>
<td valign="top">false</td>
<td valign="top">true</td>
<td valign="top">true</td>
<td valign="top">false</td>
<td valign="top">true</td>
<td valign="top">true</td>
</tr>
<tr>
<td valign="top">false</td>
<td valign="top">false</td>
<td valign="top">true</td>
<td valign="top">false</td>
<td valign="top">false</td>
<td valign="top">false</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.javahowtoguide.com/java-logical-boolean-operator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JAVA &#8211; Relational Operators</title>
		<link>http://www.javahowtoguide.com/java-relational-operators/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=java-relational-operators</link>
		<comments>http://www.javahowtoguide.com/java-relational-operators/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 13:17:40 +0000</pubDate>
		<dc:creator>Java Tutor</dc:creator>
				<category><![CDATA[Operator]]></category>
		<category><![CDATA[Relational Operators in JAVA]]></category>

		<guid isPermaLink="false">http://www.javahowtoguide.com/?p=70</guid>
		<description><![CDATA[<p> </p> <p> </p> <p>The relational operators are used to determine if one operand is equal to, greater than, less than, or not equal to the other operand with which it is compared. Just like mathematical operators, most of these operators are just like the normal operators we use in the everyday life. But certain operators are used in a different manner also.</p> <p>For example, in place of “=” operator that we generally use for comparing two operands are equal, the relational operators in the Java programming language use  “==’.</p> <p>The relational operators are defined as binary expressions, while their operands are numeric expressions.</p> <p>When applying these operators, the rules that apply to the binary operators are applied and their evaluation returns a numeric value. Not only this, the operator precedence of relational operators is higher than assignment operators but lower than arithmetic operators.</p> <p>The six relational operators used in Java and their uses are listed in the table below:</p> Relational Operator Description Equal to == Not equal to != Greater than &#62; Greater than or equal to &#62;= Less than &#60; Less than or equal to &#60;= <p>Next, let’s look at the code for the program demo_of_relational_operator that shows the use of the comparison operators.</p> <p>class demo_of_relational_operator {</p> <p>public static void main(String[] args){</p> <p>int num_var_1 = 32;</p> <p>int num_var_2 = 47;</p> <p>if(num_var_1 == num_var_2) System.out.println(&#8220;num_var_1 == num_var_2&#8243;);</p> <p>if(num_var_1 != num_var_2) System.out.println(&#8220;num_var_1 != num_var_2&#8243;);</p> <p>if(num_var_1 &#62; num_var_2) System.out.println(&#8220;num_var_1 &#62; num_var_2&#8243;);</p> <p>if(num_var_1 &#60; num_var_2) System.out.println(&#8220;num_var_1 &#60; num_var_2&#8243;);</p> <p>if(num_var_1 &#60;= num_var_2) System.out.println(&#8220;num_var_1 &#60;= num_var_2&#8243;);</p> <p>}</p> <p>}</p> <p>Output:</p> <p>num_var_1 != num_var_2</p> <p>num_var_1 &#60; num_var_2</p> <p>num_var_1 &#60;= num_var_2</p> <p>Next, let’s look at another code snipped displaying the use of different relational operators.</p> <p>public class Demo_of_Relational_Operators</p> <p>{</p> <p>public Demo_of_Relational_Operators ( )</p> <p>{</p> <p>int num_var_1 = 10, num_var_2 = 5;</p> <p>System.out.println(”num_var_1 &#62; num_var_2 : “+(num_var_1 &#62; <p>Continue reading <a href="http://www.javahowtoguide.com/java-relational-operators/">JAVA &#8211; Relational Operators</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong><br />
</strong><strong> </strong></p>
<p><strong> </strong></p>
<p>The relational operators are used to determine if one operand is equal to, greater than, less than, or not equal to the other operand with which it is compared. Just like mathematical operators, most of these operators are just like the normal operators we use in the everyday life. But certain operators are used in a different manner also.</p>
<p>For example, in place of “=” operator that we generally use for comparing two operands are equal, the relational operators in the Java programming language use  “==’.</p>
<p>The relational operators are defined as binary expressions, while their operands are numeric expressions.</p>
<p>When applying these operators, the rules that apply to the binary operators are applied and their evaluation returns a numeric value. Not only this, the operator precedence of relational operators is higher than assignment operators but lower than arithmetic operators.</p>
<p>The six relational operators used in Java and their uses are listed in the table below:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="308" valign="top">Relational Operator</td>
<td width="308" valign="top">Description</td>
</tr>
<tr>
<td width="308" valign="top">Equal to</td>
<td width="308" valign="top">==</td>
</tr>
<tr>
<td width="308" valign="top">Not equal to</td>
<td width="308" valign="top">!=</td>
</tr>
<tr>
<td width="308" valign="top">Greater than</td>
<td width="308" valign="top">&gt;</td>
</tr>
<tr>
<td width="308" valign="top">Greater than or equal to</td>
<td width="308" valign="top">&gt;=</td>
</tr>
<tr>
<td width="308" valign="top">Less than</td>
<td width="308" valign="top">&lt;</td>
</tr>
<tr>
<td width="308" valign="top">Less than or equal to</td>
<td width="308" valign="top">&lt;=</td>
</tr>
</tbody>
</table>
<p>Next, let’s look at the code for the program demo_of_relational_operator that shows the use of the comparison operators.</p>
<p>class demo_of_relational_operator {</p>
<p>public static void main(String[] args){</p>
<p>int num_var_1 = 32;</p>
<p>int num_var_2 = 47;</p>
<p>if(num_var_1 == num_var_2) System.out.println(&#8220;num_var_1 == num_var_2&#8243;);</p>
<p>if(num_var_1 != num_var_2) System.out.println(&#8220;num_var_1 != num_var_2&#8243;);</p>
<p>if(num_var_1 &gt; num_var_2) System.out.println(&#8220;num_var_1 &gt; num_var_2&#8243;);</p>
<p>if(num_var_1 &lt; num_var_2) System.out.println(&#8220;num_var_1 &lt; num_var_2&#8243;);</p>
<p>if(num_var_1 &lt;= num_var_2) System.out.println(&#8220;num_var_1 &lt;= num_var_2&#8243;);</p>
<p>}</p>
<p>}</p>
<p>Output:</p>
<p>num_var_1 != num_var_2</p>
<p>num_var_1 &lt; num_var_2</p>
<p>num_var_1 &lt;= num_var_2</p>
<p>Next, let’s look at another code snipped displaying the use of different relational operators.</p>
<p>public class Demo_of_Relational_Operators</p>
<p>{</p>
<p>public Demo_of_Relational_Operators ( )</p>
<p>{</p>
<p>int num_var_1 = 10, num_var_2 = 5;</p>
<p>System.out.println(”num_var_1 &gt; num_var_2 : “+(num_var_1 &gt; num_var_2 ));</p>
<p>System.out.println(”num_var_1 &lt; num_var_2 : “+(num_var_1 &lt; num_var_2 ));</p>
<p>System.out.println(”num_var_1 &gt;= num_var_2 : “+(num_var_1 &gt;= num_var_2 ));</p>
<p>System.out.println(”num_var_1 &lt;= num_var_2 : “+(num_var_1 &lt;= num_var_2 ));</p>
<p>System.out.println(”num_var_1 == num_var_2 : “+(num_var_1 == num_var_2 ));</p>
<p>System.out.println(”num_var_1 != num_var_2 : “+(num_var_1 != num_var_2 ));</p>
<p>}</p>
<p>public static void main(String args[]){</p>
<p>new Demo_of_Relational_Operators ();</p>
<p>}</p>
<p>}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.javahowtoguide.com/java-relational-operators/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JAVA &#8211; Arithmetic Operators</title>
		<link>http://www.javahowtoguide.com/java-arithmetic-operators/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=java-arithmetic-operators</link>
		<comments>http://www.javahowtoguide.com/java-arithmetic-operators/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 13:16:32 +0000</pubDate>
		<dc:creator>Java Tutor</dc:creator>
				<category><![CDATA[Operator]]></category>
		<category><![CDATA[Arithmetic Operators in JAVA]]></category>

		<guid isPermaLink="false">http://www.javahowtoguide.com/?p=71</guid>
		<description><![CDATA[<p> </p> <p> </p> <p>The Java programming language provides operators that perform simple mathematical operations such as addition, subtraction, multiplication, and division. These operators resemble the basic mathematics symbols that we all are aware of. Unlike the normal mathematical symbols, the “%”operator divides one operand by another and returns a remainder in the result.</p> <p>The Java programming languages uses the following symbols:</p> + Additive operator: This operator is not only used for addition, but is also used for String concatenation purposes. - Subtraction operator: This operator is used for subtracting the operands. * Multiplication operator:  This operator is used for multiplying the operands. / Division operator: This operator is used for dividing two or more operands. % remainder operator: This operator is used for obtaining the remainder by dividing one operand with another. <p>Let’s now look at a small program, Demo_of_operator_program, which shows the use of different arithmetic operators.</p> <p>class Demo_of_operator_program {</p> <p> public static void main (String[] args){</p> <p> int result_operator = 20 + 42; // The result_operator is now 62</p> <p> System.out.println(result_operator);</p> <p> result_operator = result_operator &#8211; 22; // The result_operator is now 40</p> <p> System.out.println(result_operator);</p> <p> result_operator = result_operator * 3; // The result_operator is now 120</p> <p> System.out.println(result_operator);</p> <p> result_operator = result_operator / 2; // The result_operator is now 60</p> <p> System.out.println(result_operator);</p> <p> result_operator = result_operator + 10; // The result_operator is now 70</p> <p> result_operator = result % 14; // The result_operator is now 5</p> <p> System.out.println(result_operator);</p> <p> }</p> <p>}</p> <p> </p> <p>The arithmetic operators listed above can be combined with the simple assignment operator to create compound assignments. For example the compound assignments such as, y+=1; and y=y+1; both increment the value of y by 1.</p> <p>Not only this, you can also use the + or the additive operator for joining or concatenating two <p>Continue reading <a href="http://www.javahowtoguide.com/java-arithmetic-operators/">JAVA &#8211; Arithmetic Operators</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong><br />
</strong></p>
<p><strong> </strong></p>
<p>The Java programming language provides operators that perform simple mathematical operations such as addition, subtraction, multiplication, and division. These operators resemble the basic mathematics symbols that we all are aware of. Unlike the normal mathematical symbols, the “%”operator divides one operand by another and returns a remainder in the result.</p>
<p>The Java programming languages uses the following symbols:</p>
<ul>
<li>+ Additive      operator: This operator is not only used for addition, but is also used      for String concatenation purposes.</li>
<li>- Subtraction      operator: This operator is used for subtracting the operands.</li>
<li>* Multiplication      operator:  This operator is used for      multiplying the operands.</li>
<li>/ Division      operator: This operator is used for dividing two or more operands.</li>
<li>% remainder      operator: This operator is used for obtaining the remainder by dividing      one operand with another.</li>
</ul>
<p>Let’s now look at a small program, Demo_of_operator_program, which shows the use of different arithmetic operators.</p>
<p><strong>class Demo_of_operator_program {</strong></p>
<p><strong> public static void main (String[] args){</strong></p>
<p><strong> int result_operator = 20 + 42; // The result_operator is now 62</strong></p>
<p><strong> System.out.println(result_operator);</strong></p>
<p><strong> result_operator = result_operator &#8211; 22; // The result_operator is now 40</strong></p>
<p><strong> System.out.println(result_operator);</strong></p>
<p><strong> result_operator = result_operator * 3; // The result_operator is now 120</strong></p>
<p><strong> System.out.println(result_operator);</strong></p>
<p><strong> result_operator = result_operator / 2; // The result_operator is now 60</strong></p>
<p><strong> System.out.println(result_operator);</strong></p>
<p><strong> result_operator = result_operator + 10; // The result_operator is now 70</strong></p>
<p><strong> result_operator = result % 14; // The result_operator is now 5</strong></p>
<p><strong> System.out.println(result_operator);</strong></p>
<p><strong> }</strong></p>
<p><strong>}</strong></p>
<p><strong> </strong></p>
<p>The arithmetic operators listed above can be combined with the simple assignment operator to create compound assignments. For example the compound assignments such as, y+=1; and y=y+1; both increment the value of y by 1.</p>
<p>Not only this, you can also use the + or the additive operator for joining or concatenating two strings together. The Demo_of_Concat_Stings program displayed below displays a sample of string concatenation:</p>
<p><strong>class Demo_of_Concat_Stings {</strong></p>
<p><strong> public static void main(String[] args){</strong></p>
<p><strong> String first_normal_String = &#8220;This is an&#8221;;</strong></p>
<p><strong> String second_normal_String = &#8221; arithmetic operator&#8221;;</strong></p>
<p><strong> String third_concataneted_String = first_normal_String+second_normal_String;</strong></p>
<p><strong> System.out.println(third_concataneted_String);</strong></p>
<p><strong> }</strong></p>
<p><strong>}</strong></p>
<p>This program displays the result: <strong>“This is an arithmetic operator.”</strong> which gets stored in the variable <strong>third_concataneted_String.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.javahowtoguide.com/java-arithmetic-operators/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Operators in Java</title>
		<link>http://www.javahowtoguide.com/operators-in-java/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=operators-in-java</link>
		<comments>http://www.javahowtoguide.com/operators-in-java/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 09:31:48 +0000</pubDate>
		<dc:creator>Java Tutor</dc:creator>
				<category><![CDATA[Operator]]></category>
		<category><![CDATA[JAVA Operators]]></category>

		<guid isPermaLink="false">http://www.javahowtoguide.com/?p=72</guid>
		<description><![CDATA[<p align="center"> </p> <p align="center"> </p> <p align="center"> </p> <p>Computer operators are special symbols that perform specific operations on operands to return a result. Most computer programming languages support pre-defined set of operators, similar in function to mathematical operators.</p> <p>Many a times, these operators are built-into a programming language, while at other times these may be defined in the program itself.  Therefore, languages such as C support built-in operators, while C++ and Java contain program-defined operators.</p> <p>Operator precedence and associativity are defined in computer programming language specifications. Similarly, the position of the computer operator with respect to the computer operands can be prefix, postfix, or infix.</p> <p>In the Java programming language, the operators act according to their precedence. Therefore, it is important that we know in advance about the operators with highest precedence, as these operators are evaluated before the operators with lower precedence. On the other hand, all the operators appearing on the same line have equal precedence. The Java compiler evaluates all operators, except the binary operators from left to right. Only the assignment operators are evaluated from right to left.</p> <p>The following table lists the operators according to their precedence.</p> <p></p> <p align="center">Operator Precedence</p> Name of Operator Order of Precedence Postfix expr&#8211;,  expr++ Unary ++expr, &#8211;expr, +expr, -expr, ~ ! Multiplicative * / % Additive +, - Shift &#60;&#60;, &#62;&#62;, &#62;&#62;&#62; Relational &#60;, &#62;, &#60;=, &#62;=, instanceof Equality ==, != Bitwise AND &#38; Bitwise exclusive OR ^ Bitwise inclusive OR &#124; Logical AND &#38;&#38; Logical OR &#124;&#124; Ternary ?, : Assignment = ,+=, -=, *=, /= ,%=, &#38;=, ^=, &#124;=, &#60;&#60;=, &#62;&#62;= &#62;&#62;&#62;= <p>Programmers tend to use some operators mot than the others. For example, they tend to us the assignment operator “=”much more than the unsigned left shift operator “&#62;&#62;&#62;=”</p> <p>Continue reading <a href="http://www.javahowtoguide.com/operators-in-java/">Operators in Java</a></p>]]></description>
			<content:encoded><![CDATA[<p align="center"><strong><br />
</strong></p>
<p align="center"><strong> </strong></p>
<p align="center"><strong> </strong></p>
<p>Computer operators are special symbols that perform specific operations on operands to return a result. Most computer programming languages support pre-defined set of operators, similar in function to mathematical operators.</p>
<p>Many a times, these operators are built-into a programming language, while at other times these may be defined in the program itself.  Therefore, languages such as C support built-in operators, while C++ and Java contain program-defined operators.</p>
<p>Operator precedence and associativity are defined in computer programming language specifications. Similarly, the position of the computer operator with respect to the computer operands can be prefix, postfix, or infix.</p>
<p>In the Java programming language, the operators act according to their precedence. Therefore, it is important that we know in advance about the operators with highest precedence, as these operators are evaluated before the operators with lower precedence. On the other hand, all the operators appearing on the same line have equal precedence. The Java compiler evaluates all operators, except the binary operators from left to right. Only the assignment operators are evaluated from right to left.</p>
<p>The following table lists the operators according to their precedence.</p>
<p><span id="more-72"></span></p>
<p align="center"><strong>Operator Precedence</strong></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="308" valign="top">Name of Operator</td>
<td width="308" valign="top">Order of Precedence</td>
</tr>
<tr>
<td width="308" valign="top">Postfix</td>
<td width="308" valign="top">expr&#8211;,  expr++</td>
</tr>
<tr>
<td width="308">Unary</td>
<td width="308">++expr, &#8211;expr, +expr, -expr, ~ !</td>
</tr>
<tr>
<td width="308">Multiplicative</td>
<td width="308">* / %</td>
</tr>
<tr>
<td width="308">Additive</td>
<td width="308">+, -</td>
</tr>
<tr>
<td width="308">Shift</td>
<td width="308">&lt;&lt;, &gt;&gt;, &gt;&gt;&gt;</td>
</tr>
<tr>
<td width="308">Relational</td>
<td width="308">&lt;, &gt;, &lt;=, &gt;=, instanceof</td>
</tr>
<tr>
<td width="308">Equality</td>
<td width="308">==, !=</td>
</tr>
<tr>
<td width="308">Bitwise AND</td>
<td width="308">&amp;</td>
</tr>
<tr>
<td width="308">Bitwise exclusive OR</td>
<td width="308">^</td>
</tr>
<tr>
<td width="308">Bitwise inclusive OR</td>
<td width="308">|</td>
</tr>
<tr>
<td width="308">Logical AND</td>
<td width="308">&amp;&amp;</td>
</tr>
<tr>
<td width="308">Logical OR</td>
<td width="308">||</td>
</tr>
<tr>
<td width="308">Ternary</td>
<td width="308">?, :</td>
</tr>
<tr>
<td width="308">Assignment</td>
<td width="308">= ,+=, -=, *=, /= ,%=, &amp;=, ^=, |=, &lt;&lt;=, &gt;&gt;=   &gt;&gt;&gt;=</td>
</tr>
</tbody>
</table>
<p>Programmers tend to use some operators mot than the others. For example, they tend to us the assignment operator “=”much more than the unsigned left shift operator “&gt;&gt;&gt;=”</p>
]]></content:encoded>
			<wfw:commentRss>http://www.javahowtoguide.com/operators-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

