<?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; Statement</title>
	<atom:link href="http://www.javahowtoguide.com/category/java-basics/statement/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; Condition (Decision-making) Statements</title>
		<link>http://www.javahowtoguide.com/condition-decision-making-statements/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=condition-decision-making-statements</link>
		<comments>http://www.javahowtoguide.com/condition-decision-making-statements/#comments</comments>
		<pubDate>Thu, 21 Oct 2010 05:06:42 +0000</pubDate>
		<dc:creator>Java Tutor</dc:creator>
				<category><![CDATA[Statement]]></category>
		<category><![CDATA[Decision-making Statements]]></category>

		<guid isPermaLink="false">http://www.javahowtoguide.com/?p=62</guid>
		<description><![CDATA[ <p> </p> <p> </p> <p> </p> <p>Unlike the sequential statements, the Control flow statements enable execution of parts of a code only, based on a particular condition. These control flow statements enable decision making on the program. The common decision-making statements that we use in different Java programs are:</p> if statement if-else statement if-else-if statement Nested if statement Switch <p>We will look at each of these statements in detail.</p> <p> </p> ]]></description>
			<content:encoded><![CDATA[<p><strong><br />
</strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p>Unlike the sequential statements, the Control flow statements enable execution of parts of a code only, based on a particular condition. These control flow statements enable decision making on the program. The common decision-making statements that we use in different Java programs are:</p>
<ul>
<li>if      statement</li>
<li>if-else      statement</li>
<li>if-else-if      statement</li>
<li>Nested      if statement</li>
<li>Switch</li>
</ul>
<p>We will look at each of these statements in detail.</p>
<p><strong> </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.javahowtoguide.com/condition-decision-making-statements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JAVA &#8211; Control Statements</title>
		<link>http://www.javahowtoguide.com/java-control-statements/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=java-control-statements</link>
		<comments>http://www.javahowtoguide.com/java-control-statements/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 06:12:23 +0000</pubDate>
		<dc:creator>Java Tutor</dc:creator>
				<category><![CDATA[Java Basics]]></category>
		<category><![CDATA[Statement]]></category>
		<category><![CDATA[Control Statements]]></category>

		<guid isPermaLink="false">http://www.javahowtoguide.com/?p=63</guid>
		<description><![CDATA[<p> </p> <p>As you’ve learned in the sequential statements topic, the computer while running a java program, starts executing from the topmost line of the code. It reads the first line of the code, and continues doing so till the last line. Control statements help you run a program in a manner you define. These statements are used to change the computer’s control from reading and executing the statements in a given sequence to the way you define.</p> <p>Control statements always base the program execution on a set of conditions. Let’s take an example of a programmer designing a program for a financial institute. The data for such programs is confidential and cannot be accessed by all the users. You would provide such an access to the user only if they provide the correct username and password. “Only” if both the passwords and the username are correct, should the program code allow them to see the records. The “else” part of code will run for people who don’t have valid password and enter incorrect information.</p> <p>As you can see, the control statements help you check a certain condition. You can also put one control statement into another. Such statements are then known as nested control statements. In the example given above, the financial institute software provides 3 chances o each user. If the user enters incorrect information in all the three chances, their records are locked for a particular period. A sample algorithm that would help you design such a program is shown below:</p> <p></p> <p>1. Set Variable_counter_1 to 0; 2. Show the computer screen that asks you to enter your password; 3. If the password you enter is correct, run the code that allows the user to see the records which he wanted to see; 4. Else increment Variable_counter_1  <p>Continue reading <a href="http://www.javahowtoguide.com/java-control-statements/">JAVA &#8211; Control Statements</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong><br />
</strong></p>
<p>As you’ve learned in the sequential statements topic, the computer while running a java program, starts executing from the topmost line of the code. It reads the first line of the code, and continues doing so till the last line. Control statements help you run a program in a manner you define. These statements are used to change the computer’s control from reading and executing the statements in a given sequence to the way you define.</p>
<p>Control statements always base the program execution on a set of conditions. Let’s take an example of a programmer designing a program for a financial institute. The data for such programs is confidential and cannot be accessed by all the users. You would provide such an access to the user only if they provide the correct username and password. “Only” if both the passwords and the username are correct, should the program code allow them to see the records. The “else” part of code will run for people who don’t have valid password and enter incorrect information.</p>
<p>As you can see, the control statements help you check a certain condition. You can also put one control statement into another. Such statements are then known as <strong>nested</strong> control statements. In the example given above, the financial institute software provides 3 chances o each user. If the user enters incorrect information in all the three chances, their records are locked for a particular period. A sample algorithm that would help you design such a program is shown below:</p>
<p><span id="more-63"></span></p>
<p><code><em>1. </em></code><code><em>Set</em></code><code><em> Variable_counter_1 to 0; </em></code><em><br />
<code>2. Show the computer screen that asks you to enter your password; </code><br />
<code>3. If the password you enter is correct, run the code that allows the user to see the records which he wanted to see; </code><br />
<code>4. Else increment Variable_counter_1  i.e. add one to the Variable_counter_1; </code><br />
<code>5. If Variable_counter_1 is not equal to 3, then return back to line two and Show the computer screen again that asks you to enter your password;</code><br />
<code>6. Else if Variable_counter_1  equals 3 then lock the records and display the "goodbye" screen (If the counter equals 3 this means user have tried 3 times to enter the password and he does not have valid password so the user does not have valid rights.)</code><br />
</em><br />
The code given above is a pseudo code. Since this code is written in simple English, it is understood by any person, but not by the computer.  In this pseudo code one if else statement is place within another if else statement. The manner in which the code would be executed is:</p>
<ol>
<li><code><em>1. </em></code><code><em>Enter the password</em></code></li>
<li><code><em>2. </em></code><code><em>If the password is correct, skip lines dealing with incorrect passwords i.e. lines 4,5 and 6</em></code></li>
<li><code><em>3. </em></code><code><em>Else, if the password is incorrect, read line 4 instead of reading end of line 3</em></code></li>
<li><code><em>4. </em></code><code><em>If the counter does not equal to 3, do not run line 6; but go back and run line 4 and 5</em></code></li>
<li><code><em>5. </em></code><code><em>Else, if the password is incorrect for the third time, don’t run line 4 and 5 but run line 6</em></code></li>
</ol>
<p>The control statements used in Java language are simple and can be understood by the computer easily. Because of this, they are very simple and are used extensively.  In case your condition has a complex structure, you can build it by combining a number of complex statements that contain a number of if-else statements.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.javahowtoguide.com/java-control-statements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JAVA Expressions</title>
		<link>http://www.javahowtoguide.com/java-expressions/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=java-expressions</link>
		<comments>http://www.javahowtoguide.com/java-expressions/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 10:07:16 +0000</pubDate>
		<dc:creator>Java Tutor</dc:creator>
				<category><![CDATA[Java Basics]]></category>
		<category><![CDATA[Statement]]></category>
		<category><![CDATA[Expression and statement]]></category>

		<guid isPermaLink="false">http://www.javahowtoguide.com/?p=66</guid>
		<description><![CDATA[<p> </p> <p> </p> <p> </p> <p> </p> <p>Let’s first look at expressions. An expression is a program construct defined according to the syntax of the programming language, which uses variables, operators, and methods. Let’s now look at some examples of expressions:</p> <p>int category_var = 0; </p> <p> </p> <p>cat_Array[0]=200;</p> <p> </p> <p>Now you can use these variables in the following expression:</p> <p>System.out.println(&#8220;An element 1 at index 0: &#8221; + cat_Array[0]);</p> <p> </p> <p>int result_operator = 22 + 40; // result is now 62</p> <p>The data type of resultant value returned by an expression depends on the data types of the operand used in the expression.  In the example shown above, the data type of the expression category_var = 0 return an int. This is because the assignment operator returns the value of int data type. Apart from int, the expressions can also return data of other types also such as Boolean or String.</p> <p>Not only this, you can also construct compound expressions in the Java programming language. These compound expressions can be constructed by combining a number of smaller expressions. The only condition being the data type of the left side of the expression should match the data type of the right type.</p> <p>The following code snippet displays the following compound expression:</p> <p>3 * 4 * 5</p> <p>In this example, apart from the product obtained from this expression, it is also important to note the order in which this expression is evaluated by the compiler. The outcome or the product of the expression always remains same irrespective of the order in which they appear in the expression.</p> <p></p> <p>For example, in the expression given below, the result or the outcome would vary depending on the use or evaluation of the division or the addition operator.</p> <p>Num_var_1 + Num_var_2 / <p>Continue reading <a href="http://www.javahowtoguide.com/java-expressions/">JAVA Expressions</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong><br />
</strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p>Let’s first look at <strong>expressions</strong>. An expression is a program construct defined according to the syntax of the programming language, which uses variables, operators, and methods. Let’s now look at some examples of expressions:</p>
<p>int category_var = 0;<strong> </strong></p>
<p><strong> </strong></p>
<p>cat_Array[0]=200;</p>
<p><strong> </strong></p>
<p>Now you can use these variables in the following expression:</p>
<p>System.out.println(&#8220;An element 1 at index 0: &#8221; + cat_Array[0]);</p>
<p><strong> </strong></p>
<p>int result_operator = 22 + 40; // result is now 62</p>
<p>The data type of resultant value returned by an expression depends on the data types of the operand used in the expression.  In the example shown above, the data type of the expression category_var = 0 return an int. This is because the assignment operator returns the value of int data type. Apart from <strong>int</strong>, the expressions can also return data of other types also such as <strong>Boolean</strong> or <strong>String</strong>.</p>
<p>Not only this, you can also construct compound expressions in the Java programming language. These compound expressions can be constructed by combining a number of smaller expressions. The only condition being the data type of the left side of the expression should match the data type of the right type.</p>
<p>The following code snippet displays the following compound expression:</p>
<p>3 * 4 * 5</p>
<p>In this example, apart from the product obtained from this expression, it is also important to note the order in which this expression is evaluated by the compiler. The outcome or the product of the expression always remains same irrespective of the order in which they appear in the expression.</p>
<p><span id="more-66"></span></p>
<p>For example, in the expression given below, the result or the outcome would vary depending on the use or evaluation of the division or the addition operator.</p>
<p>Num_var_1 + Num_var_2 / 25     // an unclear expression</p>
<p>The use of parenthesis in such expression makes them clear and helps determine the order of precedence.</p>
<p>Let’s see how the use of parenthesis helps in making the above unclear expression clear.</p>
<p>(Num_var_1 + Num_var_2) / 25    // use of parenthesis to rectify an unclear statement</p>
<p>The operator precedence defined within an expression takes precedence and the output is determined in that manner, if you don’t explicitly define the order of operators.  As you’ve already learnt operators having higher precedence are evaluated before the others. In the expression we just saw, the division operator would be evaluated before the addition operator.  Therefore, the result or the output of the following two statements would be the same:</p>
<p>Num_var_1 + Num_var_2 / 10</p>
<p>Num_var_1 + (Num_var_2 / 25)   // use of parenthesis to rectify an unclear statement</p>
<p>When defining compound expressions, it is important to explicitly define the order of operator precedence with the use of parenthesis. It will also help a programmer to make the code more readable and maintainable.</p>
<p>You can convert expressions into a statement by terminating the expression with a semicolon (;). Some such expressions are:</p>
<ul>
<li>Assignment      expressions</li>
<li>Use  of ++ or &#8211;</li>
<li>Method      invocations</li>
<li>Object      creation expressions</li>
</ul>
<p>These statements are known as expression statements. Some examples of expression statements are:</p>
<p>Sample_Value_var = 9834.435;</p>
<p>Sample_Value_var++;</p>
<p>System.out.println(&#8220;Hello! How are you?&#8221;);</p>
]]></content:encoded>
			<wfw:commentRss>http://www.javahowtoguide.com/java-expressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sequential Statements in JAVA</title>
		<link>http://www.javahowtoguide.com/sequential-statements-in-java/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sequential-statements-in-java</link>
		<comments>http://www.javahowtoguide.com/sequential-statements-in-java/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 06:37:18 +0000</pubDate>
		<dc:creator>Java Tutor</dc:creator>
				<category><![CDATA[Java Basics]]></category>
		<category><![CDATA[Statement]]></category>
		<category><![CDATA[Sequential Statements]]></category>

		<guid isPermaLink="false">http://www.javahowtoguide.com/?p=67</guid>
		<description><![CDATA[<p> </p> <p> </p> <p> </p> <p>A program is defined as a group of statements executed in a given order to achieve a predetermined result.  Therefore, a program executes the statements in a sequential manner, either from top to bottom or vice versa. These are executed in the manner that they appear in the program code, called the sequential execution or sequential control flow.</p> <p>The sequential statements can also be used in Processes, Procedures and Functions. These are further divided into:</p> Expressions Console Input statements Console Output statements ]]></description>
			<content:encoded><![CDATA[<p><strong><br />
</strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p>A program is defined as a group of statements executed in a given order to achieve a predetermined result.  Therefore, a program executes the statements in a sequential manner, either from top to bottom or vice versa. These are executed in the manner that they appear in the program code, called the sequential execution or sequential control flow.</p>
<p>The sequential statements can also be used in Processes, Procedures and Functions. These are further divided into:</p>
<ul>
<li>Expressions</li>
<li>Console Input      statements</li>
<li>Console Output      statements</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.javahowtoguide.com/sequential-statements-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JAVA &#8211; Different type of Statements</title>
		<link>http://www.javahowtoguide.com/java-different-type-of-statements/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=java-different-type-of-statements</link>
		<comments>http://www.javahowtoguide.com/java-different-type-of-statements/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 14:35:03 +0000</pubDate>
		<dc:creator>Java Tutor</dc:creator>
				<category><![CDATA[Statement]]></category>
		<category><![CDATA[JAVA Statement]]></category>

		<guid isPermaLink="false">http://www.javahowtoguide.com/?p=68</guid>
		<description><![CDATA[<p> </p> <p>A statement is a command given by the programmer to the computer program. Statements are used by different computer programming languages, such as Java, C, and C++. The syntax for declaring and using statements varies in each language. A simple example of a statement can be:</p> <p>println “Hello ! I hope you are enjoying your stay here”</p> <p>The statement uses a set of words “Hello! I hope you are enjoying your stay here?” and other details, such as what will be printed on screen.  The command println tells the computer to show the output on the monitor and not on the printer. The computer understands this command in the following two ways:</p> <p>The programmer can give the command to the computer in the running mode, as the program is being executed.</p> <p>They can also store a statement or a set of statements in a text file and execute it as and when required. This will then save the task of executing the statements again and again. For example, the command we just saw can be saved in a file Hello.txt and give this file to the computer.</p> <p>As stated above, you can also save a set of multiple statements in a text file, which will then be executed in the top to bottom order. This means that the statement on the top will be executed first, followed by all other statements in that order.</p> <p></p> <p>Continuing with the above example, the file “Hello.txt” can contain multiple statements in a single file:</p> <p>println “Hello! I hope you are enjoying your stay here.”</p> <p>println “How was the dinner yesterday?”</p> <p>println “Enjoy your lunch.”</p> <p>As stated above, each of these commands will be performed from top to bottom in a sequential manner. On seeing the text file, the computer:</p> Reads the <p>Continue reading <a href="http://www.javahowtoguide.com/java-different-type-of-statements/">JAVA &#8211; Different type of Statements</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong><br />
</strong></p>
<p>A statement is a command given by the programmer to the computer program. Statements are used by different computer programming languages, such as Java, C, and C++. The syntax for declaring and using statements varies in each language. A simple example of a statement can be:</p>
<p><strong>println “Hello ! I hope you are enjoying your stay here”</strong></p>
<p>The statement uses a set of words <strong>“Hello! I hope you are enjoying your stay here?”</strong> and other details, such as what will be printed on screen.  The command <strong>println</strong> tells the computer to show the output on the monitor and not on the printer. The computer understands this command in the following two ways:</p>
<p>The programmer can give the command to the computer in the running mode, as the program is being executed.</p>
<p>They can also store a statement or a set of statements in a text file and execute it as and when required. This will then save the task of executing the statements again and again. For example, the command we just saw can be saved in a file <strong>Hello.txt</strong> and give this file to the computer.</p>
<p>As stated above, you can also save a set of multiple statements in a text file, which will then be executed in the top to bottom order. This means that the statement on the top will be executed first, followed by all other statements in that order.</p>
<p><span id="more-68"></span></p>
<p>Continuing with the above example, the file <strong>“Hello.txt”</strong> can contain multiple statements in a single file:</p>
<p><strong>println “Hello! I hope you are enjoying your stay here.”</strong></p>
<p><strong>println “How was the dinner yesterday?”</strong></p>
<p><strong>println “Enjoy your lunch.”</strong></p>
<p>As stated above, each of these commands will be performed from top to bottom in a sequential manner. On seeing the text file, the computer:</p>
<ul>
<li>Reads the first statement from the text file</li>
<li>Determines if it is a <strong><em>println</em></strong> statement</li>
<li>Determines the text that needs to be printed</li>
<li>Displays the text on screen.</li>
</ul>
<p>Therefore, the first command to be displayed on the screen would be: <strong>Hello! I hope you are enjoying your stay here.</strong></p>
<p>The last statement would be: What is the duration of the course</p>
<p>The question marks that you saw in the code are not displayed on the computer screen. These punctuation marks are used to tell the computer where the statement would begin and end respectively. The computer then reads the second line, followed by the third line and displays the output in the following manner:</p>
<p><strong>Hello! I hope you are enjoying your stay here.</strong></p>
<p><strong>How was the dinner yesterday?</strong></p>
<p><strong>Enjoy your lunch.</strong></p>
<p>The computer stops reading the file once it reaches the end of the file. It is important to provide correct code in these text files, otherwise the code can also be erroneous.</p>
<p>Different programming languages use different types of computer statements. For example, a language can use a <strong>beep</strong> statement directing the computer to produce a beep in its speakers. Similarly, a <strong>window</strong> statement can direct the computer to popup a new window.</p>
<p>Not only this, different programming languages display and code statements differently. The set of rules such as <strong>println</strong> used to describe a statement is known as its <em>syntax</em>, while the actual message that needs to be displayed in known as its <strong>library.</strong></p>
<p>Therefore, we can say that statements are used to change the value of variables, process input, display the desired output, or produce an action in response to user mouse or keyboard actions.</p>
<p>Different types of statements that we will commonly come across in the Java are:</p>
<ul>
<li>Assignment Statements</li>
<li>Message Statements</li>
<li>Statement Blocks</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.javahowtoguide.com/java-different-type-of-statements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

