<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-8947640765488864381</atom:id><lastBuildDate>Sun, 12 Jan 2025 22:51:03 +0000</lastBuildDate><category>CodeProject</category><category>C# Tutorials</category><category>Java Tutorials</category><title>Software and Development</title><description>This blog mainly about software and development, By software I mean software developed by me to make simple tasks that you would like to have (or not) and its all free and free (free of viruses and free money), By development I will put some tutorials for some things developers would need I know that because I needed them before, there will also be tutorials for how to make some of the softwares I provide to you, Hope you find this blog useful and enjoy your time. </description><link>http://developware.blogspot.com/</link><managingEditor>noreply@blogger.com (M)</managingEditor><generator>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8947640765488864381.post-1295297406014474400</guid><pubDate>Mon, 22 Oct 2012 20:05:00 +0000</pubDate><atom:updated>2012-10-22T23:32:22.561+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C# Tutorials</category><title>C# for beginners Part 3</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Calculator (Functions Or Methods)&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
Welcome to your third C# for beginners tutorial, in this tutorial you will learn the simple Calculator program after you&#39;ve learned&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/2012/10/c-for-beginners-part-1.html&quot; target=&quot;_blank&quot;&gt;Hello World!&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/2012/10/c-for-beginners-part-2.html&quot;&gt;Hello Me!&lt;/a&gt;.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;h3&gt;
Things you will need:&lt;/h3&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;Microsoft Visual Studio you can download the express edition for free from here&amp;nbsp;&lt;a href=&quot;http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-for-windows-desktop#product-express-desktop-details&quot; target=&quot;_blank&quot;&gt;free visual studio&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Read Hello Me! if you didn&#39;t read it yet&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/2012/10/c-for-beginners-part-2.html&quot; target=&quot;_blank&quot;&gt;From here.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;10 minutes of your time.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;h3&gt;
Lets start:&lt;/h3&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
Now that you ready to make your third program after installing Microsoft Visual Studio lets open it, now you will have to create a new project there is lots of project&#39;s types you can choose from but we will start with the simplest and very basic one of them the Console application.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;File&amp;gt;&amp;gt;New&amp;gt;&amp;gt;Project&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
you will get a window similar to this (it may look different depending on the version of your Visual Studio)&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFQeMvcegXC-C7r1qwmaYAC5CXyTXw-pxwVc3ZgIM6aahO0sm58dgRoQ2gMDEorZDAqBz3oLa6DOzchjVTJ0qsmiVQQqvYH7hq0-XN677M2o-FFh-Ur_h_jDt78p9wZ2XW6Bk2Oz79n2oT/s1600/Untitled-CSProject+type3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Project Type&quot; border=&quot;0&quot; height=&quot;229&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFQeMvcegXC-C7r1qwmaYAC5CXyTXw-pxwVc3ZgIM6aahO0sm58dgRoQ2gMDEorZDAqBz3oLa6DOzchjVTJ0qsmiVQQqvYH7hq0-XN677M2o-FFh-Ur_h_jDt78p9wZ2XW6Bk2Oz79n2oT/s1600/Untitled-CSProject+type3.jpg&quot; title=&quot;Project Type&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Project Type&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
Choose&amp;nbsp;&lt;b&gt;Visual C#&lt;/b&gt;&amp;nbsp;for the programming language then&amp;nbsp;&lt;b&gt;Console Application&lt;/b&gt;&amp;nbsp;for the program type.&lt;/div&gt;
&lt;div&gt;
For the name type Calculator or whatever you like your program name to be, But in here I will be using Calculator as the project name so its a good practice to do the same so that names wont make you confused.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now that you created the project its time to start writing some codes, This is how your code will look like when you open Program.cs file&lt;/div&gt;
&lt;div&gt;
&lt;pre&gt;&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System.Collections.Generic;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System.Linq;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System.Text;

&lt;span style=&quot;color: blue;&quot;&gt;namespace&lt;/span&gt;&amp;nbsp;Calculator
{
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #3d85c6;&quot;&gt;Program&lt;/span&gt;
&amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;static void&lt;/span&gt;&amp;nbsp;Main(&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;[] args)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; }
}&lt;/div&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Our program is very simple all we want to do is to make our program ask you to insert a number then second one and Then adds them and give you the result and to make the program read anything from the Console we use Console.ReadLine(); we will also use variables in this program.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE:&amp;nbsp;&lt;/b&gt;Variables are containers that hold our data temporary it has many types as we may need to store text or numbers or anything else&lt;br /&gt;
text = string &amp;nbsp; &amp;nbsp; &amp;nbsp; ex:&quot;This is sentence&quot;&lt;br /&gt;
number = int &amp;nbsp; &amp;nbsp; &amp;nbsp;ex: 1&lt;br /&gt;
point number = float or decimal &amp;nbsp; &amp;nbsp; &amp;nbsp; ex: 1.5&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
Now lets make our program ask for your first number, In the Main type Console.WriteLine(&quot;Please enter the first number&quot;);&lt;br /&gt;
Then we need to get your number from the Console window so we will declare a variable called num1 of type int and put your number there first here is how to declare a variable of type int&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;num1;&lt;/div&gt;
&lt;br /&gt;
its as easy as that but we need &amp;nbsp;to tell our program to put your number in this variable because now we reserved an integer space in our memory and never used it and this is how to tell your program to read your number from the Console window and put it in the variable num1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;num1 = &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;.Parse(&lt;span style=&quot;color: #3d85c6;&quot;&gt;Console&lt;/span&gt;.ReadLine() );&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE:&amp;nbsp;&lt;/b&gt;int.Parse() is a simple command that convert the String to a number to be able to put it in an integer variable because Console.ReadLine() returns a String and our variable is int that&#39;s why we use it.&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE:&amp;nbsp;&lt;/b&gt;If the data between int.Parse() brackets isn&#39;t a number it will return an error for example int.Parse(&quot;a&quot;) will return an error also int.Parse(&quot;1.1&quot;) will return an error.&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will do the same with the other number and create another variable called num2&lt;br /&gt;
now all we need to do is to add the two numbers and display the result which is simple as we learned before how to display any text on the Console window but there is a little thing we will add there because we want the program to output num1 + num2 = result so you will notice the difference when we reach this step but now we will make a function or method which are the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE:&amp;nbsp;&lt;/b&gt;Functions is block of codes to be used in different places in the same code.&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
this is how we declare the function&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;private static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&amp;nbsp;add(&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;x,&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;y)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;/div&gt;
&lt;br /&gt;
when we declare a function we first set if its going to be public or private which simply means if it private then we cant use it out of this code file if it public then we can, then we declare that its static which will be explained in later tutorials, then we set the return type which means that this function will return a text for me in our case, then we set the function name which can be whatever you want here I called it add, then between the brackets we put our arguments which are values we will be using in the function here I put 2 variables of type int because we will send our 2 numbers to our function.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE:&amp;nbsp;&lt;/b&gt;If your function wont return any values you can use void as the return type.&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE:&amp;nbsp;&lt;/b&gt;Functions must be declared outside the Main function.&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;private static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&amp;nbsp;add(&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;x,&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;y)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; result = x + y;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #3d85c6;&quot;&gt;String&lt;/span&gt;.Format(&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;{0} + {1} = {2}&quot;&lt;/span&gt;, x, y, result);&lt;br /&gt;
}&lt;/div&gt;
&lt;br /&gt;
In our function we simple declared another variable which is the result and added our 2 numbers and put the sum in the result variable then we returned the string and we used format to make our output in a specific format which is num1 + num2 = result&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then all we need to do is to call our function and display its return value and this is how&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
&lt;span style=&quot;color: #3d85c6;&quot;&gt;Console&lt;/span&gt;.WriteLine(add(num1,num2));&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Now this is how your final code will look like&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System.Collections.Generic;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System.Linq;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System.Text;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;namespace&lt;/span&gt;&amp;nbsp;Calculator&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #3d85c6;&quot;&gt;Program&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;static void&lt;/span&gt;&amp;nbsp;Main(&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;[] args)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #3d85c6;&quot;&gt;Console&lt;/span&gt;.WriteLine(&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;Please enter your first number&quot;&lt;/span&gt;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;num1 =&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;.Parse(&lt;span style=&quot;color: #3d85c6;&quot;&gt;Console&lt;/span&gt;.ReadLine() );&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #3d85c6;&quot;&gt;Console&lt;/span&gt;.WriteLine(&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;Please enter your second number&quot;&lt;/span&gt;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;num2 =&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;.Parse(&lt;span style=&quot;color: #3d85c6;&quot;&gt;Console&lt;/span&gt;.ReadLine() );&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #3d85c6;&quot;&gt;Console&lt;/span&gt;.WriteLine(add(num1,num2));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;private static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&amp;nbsp;add(&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;x,&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;y)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;result = x + y;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #3d85c6;&quot;&gt;String&lt;/span&gt;.Format(&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;{0} + {1} = {2}&quot;&lt;/span&gt;, x, y, result);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;/div&gt;
&lt;br /&gt;
Now lets Run our program and see what we did press&amp;nbsp;&lt;b&gt;Ctrl+F5&lt;/b&gt;&amp;nbsp;to run your program&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhbV8eE-wSeaSl6h8UXZoimN-nPWwHN291jm8kNrIw14Ey0-cCO3EAxxQd0vwcPZ7YB0VSSdRwUpzRtOX66iTsi2W3-U1eiibfvAi5jIXKKkGQXrmtvubfDy1FyBODpSDTf-DPexc3LmYy/s1600/CSResult3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Console Window&quot; border=&quot;0&quot; height=&quot;163&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhbV8eE-wSeaSl6h8UXZoimN-nPWwHN291jm8kNrIw14Ey0-cCO3EAxxQd0vwcPZ7YB0VSSdRwUpzRtOX66iTsi2W3-U1eiibfvAi5jIXKKkGQXrmtvubfDy1FyBODpSDTf-DPexc3LmYy/s1600/CSResult3.jpg&quot; title=&quot;Console Window&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;The Result&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
Congratulations now you have done your third C# Program you are ready to learn more&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE: Click Download below to download sample project.&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/p/tutorials-downloads.html#CS3&quot; target=&quot;_blank&quot;&gt;More Download Links&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;a href=&quot;http://adf.ly/DwLCB&quot;&gt;&lt;img alt=&quot;Download From FileFactory!&quot; src=&quot;http://www.filefactory.com/img/buttons/download/purple.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
Hope you enjoyed and&amp;nbsp;benefited from this tutorial please feel free to comment or ask about anything and more tutorials will be added.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
Thank you for reading and enjoy your day.&amp;nbsp;&lt;/div&gt;
&lt;a href=&quot;http://www.codeproject.com/&quot; rel=&quot;tag&quot; style=&quot;display: none;&quot;&gt;CodeProject&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://developware.blogspot.com/2012/10/c-for-beginners-part-3.html</link><author>noreply@blogger.com (M)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFQeMvcegXC-C7r1qwmaYAC5CXyTXw-pxwVc3ZgIM6aahO0sm58dgRoQ2gMDEorZDAqBz3oLa6DOzchjVTJ0qsmiVQQqvYH7hq0-XN677M2o-FFh-Ur_h_jDt78p9wZ2XW6Bk2Oz79n2oT/s72-c/Untitled-CSProject+type3.jpg" height="72" width="72"/><thr:total>9</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8947640765488864381.post-4846177579365983671</guid><pubDate>Wed, 17 Oct 2012 14:53:00 +0000</pubDate><atom:updated>2012-10-22T22:06:29.215+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java Tutorials</category><title>Java for beginners Part 3</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Calculator (Functions Or Methods)&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
Welcome to your third Java for beginners tutorial, in this tutorial you will learn the simple hello Me program after you&#39;ve learned&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/2012/10/java-for-beginners-part-1.html&quot; target=&quot;_blank&quot;&gt;Hello World!&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/2012/10/java-for-beginners-part-2.htm&quot; target=&quot;_blank&quot;&gt;Hello Me!.&lt;/a&gt;.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;h3&gt;
Things you will need:&lt;/h3&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;Java you can download it if it isn&#39;t already installed from Java official site&amp;nbsp;&lt;a href=&quot;http://www.java.com/en/&quot; target=&quot;_blank&quot;&gt;free Java.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;NetBeans you can download it for free from NetBeans official site&amp;nbsp;&lt;a href=&quot;http://netbeans.org/&quot; target=&quot;_blank&quot;&gt;free NetBeans.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Read Hello Me! if you didn&#39;t read it yet&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/2012/10/java-for-beginners-part-2.htm&quot; target=&quot;_blank&quot;&gt;From here.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;10 minutes of your time.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE:&amp;nbsp;&lt;/b&gt;Its&amp;nbsp;advised&amp;nbsp;to download and install Java&amp;nbsp;&lt;b&gt;before&amp;nbsp;&lt;/b&gt;installing NetBeans.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
Lets start:&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
Now that you ready to make your third program after installing Java and NetBeans lets open NetBeans, now you will have to create a new project there is lots of project&#39;s types you can choose from but we will start with the simplest and very basic one of them the Java application.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;b&gt;File&amp;gt;&amp;gt;New Project&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
you will get a window similar to this (it may look different depending on the version of your NetBeans and other installed programs you have or&amp;nbsp;have not)&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvUiRTZKujp0FzuZOR9upjVOJcSay0AfiddyT7XqkvYc8Ak3MG4sMlQ6xe1QK0QOML6nuV3IE6Z_AFnluPMz8F7yUCP47a2oUWoNP75BTABM8s5cDm2BJeNfn5Mprx29uxB0i2zXsFH3RZ/s1600/project+type+java.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;New Project&quot; border=&quot;0&quot; height=&quot;275&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvUiRTZKujp0FzuZOR9upjVOJcSay0AfiddyT7XqkvYc8Ak3MG4sMlQ6xe1QK0QOML6nuV3IE6Z_AFnluPMz8F7yUCP47a2oUWoNP75BTABM8s5cDm2BJeNfn5Mprx29uxB0i2zXsFH3RZ/s400/project+type+java.jpg&quot; title=&quot;New Project&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;font-size: 13px;&quot;&gt;Project Type&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
Choose&amp;nbsp;&lt;b&gt;Java&lt;/b&gt;&amp;nbsp;for the Categories then&amp;nbsp;&lt;b&gt;Java Application&lt;/b&gt;&amp;nbsp;for the Projects then&amp;nbsp;&lt;b&gt;Next&amp;gt;&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJhYshrzXCsjIdtNreBxGExyrTxntS5oWuEZiow3SDiRCasRTexGqKoeHzDsTQsao-ciQmVyZFkd7Ma0MLL5pIRc9eOkvU_NxZopoJhi3OtTbshibinYUpXgGW6BAXph_c5PvUmZtC9rpN/s1600/JavaProject+name3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Project Name&quot; border=&quot;0&quot; height=&quot;220&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJhYshrzXCsjIdtNreBxGExyrTxntS5oWuEZiow3SDiRCasRTexGqKoeHzDsTQsao-ciQmVyZFkd7Ma0MLL5pIRc9eOkvU_NxZopoJhi3OtTbshibinYUpXgGW6BAXph_c5PvUmZtC9rpN/s1600/JavaProject+name3.jpg&quot; title=&quot;Project Name&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Project Name&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
For the name type Calculator or whatever you like your program name to be, But in here I will be using Calculator as the project name so its a good practice to do the same so that names wont make you confused.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
Now that you created the project its time to start writing some codes, This is how your code will look like when you open Calculator.java file&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;/*&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* To change this template, choose Tools | Templates&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* and open the template in the editor.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;package&amp;nbsp;&lt;/span&gt;calculator;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* @author YourName&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;public class&amp;nbsp;&lt;/span&gt;&lt;b&gt;Calculator&lt;/b&gt;&amp;nbsp;{&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* @param args the command line arguments&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; public static void&amp;nbsp;&lt;/span&gt;&lt;b&gt;main&lt;/b&gt;(String[] args) {&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;// TODO code application logic here&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&amp;nbsp;}&lt;br /&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Our program is very simple all we want to do is to make our program ask you to insert a number then second one and Then adds them and give you the result and to make the program read anything from the Output Window we create an object from Scanner Class we will also use variables in this program.&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE:&amp;nbsp;&lt;/b&gt;Variables are containers that hold our data temporary it has many types as we may need to store text or numbers or anything else&lt;br /&gt;
text = String &amp;nbsp; &amp;nbsp; &amp;nbsp; ex:&quot;This is sentence&quot;&lt;br /&gt;
number = int &amp;nbsp; &amp;nbsp; &amp;nbsp;ex: 1&lt;br /&gt;
point number = float &amp;nbsp; &amp;nbsp; &amp;nbsp; ex: 1.5&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE:&amp;nbsp;&lt;/b&gt;Scanner Class is&amp;nbsp;A simple text scanner which can parse primitive types and strings using regular expressions.&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
Now lets make our program ask for the first number, In the Main type System.out.Println(&quot;Please enter the first number&quot;);&lt;br /&gt;
Now we need to create an object of Scanner Class and name it input or whatever you want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
Scanner input=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Scanner(System.&lt;span style=&quot;color: #38761d;&quot;&gt;in&lt;/span&gt;);&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Then we need to get the first number from the Output window so we will declare a variable called num1 of type integer and put your first number there first here is how to declare a variable of type int&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;num1;&lt;/div&gt;
&lt;br /&gt;
its as easy as that but we need &amp;nbsp;to tell our program to put your number in this variable because now we reserved a integer space in our memory and never used it and this is how to tell your program to read your number from the Output window and put it in the variable num1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; num1 = input.nextInt();&lt;/div&gt;
&lt;br /&gt;
We will do the same with the other number and create another variable called num2&lt;br /&gt;
now all we need to do is to add the two numbers and display the result which is simple as we learned before how to display any text on the Output window but there is a little thing we will add there because we want the program to output num1 + num2 = result so you will notice the difference when we reach this step but now we will make a function or method which are the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE:&amp;nbsp;&lt;/b&gt;Functions is block of codes to be used in different places in the same code.&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
this is how we declare the function&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;private static&lt;/span&gt; String &lt;b&gt;add&lt;/b&gt;(&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; x, &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; y)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;/div&gt;
&lt;br /&gt;
when we declare a function we first set if its going to be public or private which simply means if it private then we cant use it out of this code file if it public then we can, then we declare that its static which will be explained in later tutorials, then we set the return type which means that this function will return a text for me in our case, then we set the function name which can be whatever you want here I called it add, then between the brackets we put our arguments which are values we will be using in the function here I put 2 variables of type int because we will send our 2 numbers to our function.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE:&amp;nbsp;&lt;/b&gt;If your function wont return any values you can use void as the return type.&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE: &lt;/b&gt;Functions must be declared outside the Main function.&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;private static&lt;/span&gt;&amp;nbsp;String&amp;nbsp;&lt;b&gt;add&lt;/b&gt;(&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;x,&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;y)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; result=x+y;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; String.format(&lt;span style=&quot;color: #e69138;&quot;&gt;&quot;%d + %d = %d&quot;&lt;/span&gt;, x,y,result);&lt;br /&gt;
}&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
In our function we simple declared another variable which is the result and added our 2 numbers and put the sum in the result variable then we returned the string and we used format to make our output in a specific format which is num1 + num2 = result&lt;br /&gt;
&lt;br /&gt;
Then all we need to do is to call our function and display its return value and this is how&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
System.&lt;span style=&quot;color: #38761d;&quot;&gt;out&lt;/span&gt;.println(add(num1,num2));&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Now that is how your final code will look like.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;/*&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* To change this template, choose Tools | Templates&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* and open the template in the editor.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;package&amp;nbsp;&lt;/span&gt;hellome;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;import&amp;nbsp;&lt;/span&gt;java.util.Scanner;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* @author YourName&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;public class&amp;nbsp;&lt;/span&gt;&lt;b&gt;HelloMe&lt;/b&gt;&amp;nbsp;{&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* @param args the command line arguments&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; public static void&amp;nbsp;&lt;/span&gt;&lt;b&gt;main&lt;/b&gt;(String[] args) {&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;// TODO code application logic here&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;System.&lt;span style=&quot;color: #38761d;&quot;&gt;out&lt;/span&gt;.print(&lt;span style=&quot;color: #e69138;&quot;&gt;&quot;Please enter the first number&quot;&lt;/span&gt;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;Scanner name=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Scanner(System.&lt;span style=&quot;color: #38761d;&quot;&gt;in&lt;/span&gt;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; num1 =&amp;nbsp;input.nextInt();&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;System.&lt;span style=&quot;color: #38761d;&quot;&gt;out&lt;/span&gt;.print(&lt;span style=&quot;color: #e69138;&quot;&gt;&quot;Please enter the second number&quot;&lt;/span&gt;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;num2 =&amp;nbsp;input.nextInt();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;System.&lt;span style=&quot;color: #38761d;&quot;&gt;out&lt;/span&gt;.println(add(num1,num2));&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;private static&lt;/span&gt;&amp;nbsp;String&amp;nbsp;&lt;b&gt;add&lt;/b&gt;(&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;x,&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;y)&lt;br /&gt;
&amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;result=x+y;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;String.format(&lt;span style=&quot;color: #e69138;&quot;&gt;&quot;%d + %d = %d&quot;&lt;/span&gt;, x,y,result);&lt;br /&gt;
&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
Now lets Run our program and see what we did press&amp;nbsp;&lt;b&gt;F6&lt;/b&gt;&amp;nbsp;to run your program.&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2AFhqP8ISUgC5drFzSo7j2l31-6RYdReWy0MASPJqzlwQaUnJ35YcCWS2ImOWeTGQJUqYccIj8UqiSi5TzylUjB7-T-gOixCpToemua3Ee2Kj-XEeI7nJBJAk4fvKVKVdcGwTsA0cKqd3/s1600/JavaResult3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Output Result&quot; border=&quot;0&quot; height=&quot;64&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2AFhqP8ISUgC5drFzSo7j2l31-6RYdReWy0MASPJqzlwQaUnJ35YcCWS2ImOWeTGQJUqYccIj8UqiSi5TzylUjB7-T-gOixCpToemua3Ee2Kj-XEeI7nJBJAk4fvKVKVdcGwTsA0cKqd3/s1600/JavaResult3.jpg&quot; title=&quot;Output Result&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;The Result&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
Congratulations now you have done your third Java Program you are ready to learn more&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE: Click Download below to download sample project.&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/p/tutorials-downloads.html#j3&quot; target=&quot;_blank&quot;&gt;More Download Links&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;a href=&quot;http://adf.ly/Dm96E&quot;&gt;&lt;img alt=&quot;Download From FileFactory!&quot; src=&quot;http://www.filefactory.com/img/buttons/download/purple.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
Hope you enjoyed and&amp;nbsp;benefited from this tutorial please feel free to comment or ask about anything and more tutorials will be added.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
Thank you for reading and enjoy your day.&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://developware.blogspot.com/2012/10/java-for-beginners-part-3.html</link><author>noreply@blogger.com (M)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvUiRTZKujp0FzuZOR9upjVOJcSay0AfiddyT7XqkvYc8Ak3MG4sMlQ6xe1QK0QOML6nuV3IE6Z_AFnluPMz8F7yUCP47a2oUWoNP75BTABM8s5cDm2BJeNfn5Mprx29uxB0i2zXsFH3RZ/s72-c/project+type+java.jpg" height="72" width="72"/><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8947640765488864381.post-2283763163646718246</guid><pubDate>Wed, 10 Oct 2012 19:55:00 +0000</pubDate><atom:updated>2012-10-17T15:18:42.325+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">CodeProject</category><category domain="http://www.blogger.com/atom/ns#">Java Tutorials</category><title>Java for beginners Part 2</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Hello Me!&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
Welcome to your second Java for beginners tutorial, in this tutorial you will learn the simple hello Me program after you&#39;ve learned&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/2012/10/java-for-beginners-part-1.html&quot; target=&quot;_blank&quot;&gt;Hello World!&lt;/a&gt;.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;h3&gt;
Things you will need:&lt;/h3&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;Java you can download it if it isn&#39;t already installed from Java official site&amp;nbsp;&lt;a href=&quot;http://www.java.com/en/&quot; target=&quot;_blank&quot;&gt;free Java.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;NetBeans you can download it for free from NetBeans official site&amp;nbsp;&lt;a href=&quot;http://netbeans.org/&quot; target=&quot;_blank&quot;&gt;free NetBeans.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Read Hello World! if you didn&#39;t read it yet&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/2012/10/java-for-beginners-part-1.html&quot; target=&quot;_blank&quot;&gt;From here.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;10 minutes of your time.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE:&amp;nbsp;&lt;/b&gt;Its&amp;nbsp;advised&amp;nbsp;to download and install Java&amp;nbsp;&lt;b&gt;before&amp;nbsp;&lt;/b&gt;installing NetBeans.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
Lets start:&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
Now that you ready to make your second program after installing Java and NetBeans lets open NetBeans, now you will have to create a new project there is lots of project&#39;s types you can choose from but we will start with the simplest and very basic one of them the Java application.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;b&gt;File&amp;gt;&amp;gt;New Project&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
you will get a window similar to this (it may look different depending on the version of your NetBeans and other installed programs you have or&amp;nbsp;have not)&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvUiRTZKujp0FzuZOR9upjVOJcSay0AfiddyT7XqkvYc8Ak3MG4sMlQ6xe1QK0QOML6nuV3IE6Z_AFnluPMz8F7yUCP47a2oUWoNP75BTABM8s5cDm2BJeNfn5Mprx29uxB0i2zXsFH3RZ/s1600/project+type+java.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;New Project&quot; border=&quot;0&quot; height=&quot;275&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvUiRTZKujp0FzuZOR9upjVOJcSay0AfiddyT7XqkvYc8Ak3MG4sMlQ6xe1QK0QOML6nuV3IE6Z_AFnluPMz8F7yUCP47a2oUWoNP75BTABM8s5cDm2BJeNfn5Mprx29uxB0i2zXsFH3RZ/s400/project+type+java.jpg&quot; title=&quot;New Project&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;font-size: 13px;&quot;&gt;Project Type&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
Choose&amp;nbsp;&lt;b&gt;Java&lt;/b&gt;&amp;nbsp;for the Categories then&amp;nbsp;&lt;b&gt;Java Application&lt;/b&gt;&amp;nbsp;for the Projects then&amp;nbsp;&lt;b&gt;Next&amp;gt;&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOwZsu06-VCdGOLBIfe9Ifoli_RL8oSLMt9Vmr0kB2NPnXMCnaiZNgA4ezDjJVyIdKnDTJXRnB8Jc-Akkd-BUEhbqf3VN-O1NEfU-wJTn5-PJ3qDRGbHAzpfXVbXJkrdaQhzikZu90VdtA/s1600/JavaProject+name2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Project Name&quot; border=&quot;0&quot; height=&quot;272&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOwZsu06-VCdGOLBIfe9Ifoli_RL8oSLMt9Vmr0kB2NPnXMCnaiZNgA4ezDjJVyIdKnDTJXRnB8Jc-Akkd-BUEhbqf3VN-O1NEfU-wJTn5-PJ3qDRGbHAzpfXVbXJkrdaQhzikZu90VdtA/s1600/JavaProject+name2.jpg&quot; title=&quot;Project Name&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Project Name&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
For the name type HelloMe or whatever you like your program name to be, But in here I will be using HelloMe as the project name so its a good practice to do the same so that names wont make you confused.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
Now that you created the project its time to start writing some codes, This is how your code will look like when you open HelloMe.java file&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;/*&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* To change this template, choose Tools | Templates&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* and open the template in the editor.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;package&amp;nbsp;&lt;/span&gt;hellome;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* @author YourName&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;public class&amp;nbsp;&lt;/span&gt;&lt;b&gt;HelloMe&lt;/b&gt;&amp;nbsp;{&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* @param args the command line arguments&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; public static void&amp;nbsp;&lt;/span&gt;&lt;b&gt;main&lt;/b&gt;(String[] args) {&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;// TODO code application logic here&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&amp;nbsp;}&lt;br /&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Our program is very simple all we want to do is to make our program ask for your name and Then welcomes you by saying Hello Yourname! and to make the program read anything from the Output Window we create an object from Scanner Class we will also use variables in this program.&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE:&amp;nbsp;&lt;/b&gt;Variables are containers that hold our data temporary it has many types as we may need to store text or numbers or anything else&lt;br /&gt;
text = String &amp;nbsp; &amp;nbsp; &amp;nbsp; ex:&quot;This is sentence&quot;&lt;br /&gt;
number = int &amp;nbsp; &amp;nbsp; &amp;nbsp;ex: 1&lt;br /&gt;
point number = float &amp;nbsp; &amp;nbsp; &amp;nbsp; ex: 1.5&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE: &lt;/b&gt;Scanner Class is&amp;nbsp;A simple text scanner which can parse primitive types and strings using        regular expressions.&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
Now lets make our program ask for your name and run it, In the Main type System.out.Println(&quot;What is your name?&quot;);&lt;br /&gt;
Now we need to create an object of Scanner Class and name it input or whatever you want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
Scanner name= &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; Scanner(System.&lt;span style=&quot;color: #38761d;&quot;&gt;in&lt;/span&gt;);&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Then we need to get your name from the Output window so we will declare a variable called name of type string and put your name there first here is how to declare a variable of type string&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
String&amp;nbsp;name;&lt;/div&gt;
&lt;br /&gt;
its as easy as that but we need &amp;nbsp;to tell our program to put your name in this variable because now we reserved a string space in our memory and never used it and this is how to tell your program to read your name from the Output window and put it in the variable name.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
String&amp;nbsp;name = input.nextLine();&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
now all we need to do is to display the welcome message which is simple as we learned before how to display any text on the Output window but there is a little thing we will add there because we want the program to say Hello Your name so this is done like this&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
System.&lt;span style=&quot;color: #38761d;&quot;&gt;out&lt;/span&gt;.println(&lt;span style=&quot;color: #e69138;&quot;&gt;&quot;Hello &quot;&lt;/span&gt; + name + &lt;span style=&quot;color: #e69138;&quot;&gt;&quot;!&quot;&lt;/span&gt;);&lt;/div&gt;
&lt;br /&gt;
What the plus sign means is add the text in this variable from type string to that text in that position&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE:&amp;nbsp;&lt;/b&gt;Always remember to&amp;nbsp;&amp;nbsp;put space after hello because if you didnt it will be HelloYourname without spaces it doesnt matter how many spaces you put after the&amp;nbsp;quotation mark it will be ignored.&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;color: black;&quot;&gt;Now that is how your final code will look like.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;/*&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* To change this template, choose Tools | Templates&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* and open the template in the editor.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;package&amp;nbsp;&lt;/span&gt;hellome;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;import &lt;/span&gt;java.util.Scanner;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* @author YourName&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;public class&amp;nbsp;&lt;/span&gt;&lt;b&gt;HelloMe&lt;/b&gt;&amp;nbsp;{&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* @param args the command line arguments&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; public static void&amp;nbsp;&lt;/span&gt;&lt;b&gt;main&lt;/b&gt;(String[] args) {&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;// TODO code application logic here&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;System.&lt;span style=&quot;color: #38761d;&quot;&gt;out&lt;/span&gt;.print(&lt;span style=&quot;color: #e69138;&quot;&gt;&quot;What is your name?&quot;&lt;/span&gt;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;Scanner name=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Scanner(System.&lt;span style=&quot;color: #38761d;&quot;&gt;in&lt;/span&gt;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;String&amp;nbsp;name =&amp;nbsp;input.nextLine();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;System.&lt;span style=&quot;color: #38761d;&quot;&gt;out&lt;/span&gt;.println(&lt;span style=&quot;color: #e69138;&quot;&gt;&quot;Hello &quot;&lt;/span&gt;&amp;nbsp;+ name +&amp;nbsp;&lt;span style=&quot;color: #e69138;&quot;&gt;&quot;!&quot;&lt;/span&gt;);&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&amp;nbsp;}&lt;br /&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
Now lets Run our program and see what we did press&amp;nbsp;&lt;b&gt;F6&lt;/b&gt;&amp;nbsp;to run your program.&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3ge9UGQqHTYJ5_WAlBrOnzp4Ib6nE7C1b0LIwW17vvVUnpLayGth_BBhWKqFLD3DGwxEfZh1BdJbzDdDfGktHgz3fvsY2vfXRwKQhTyAMPTRc0xYpGpPl81OcihAAA8FYHOhqKtaKPEYi/s1600/JavaResult2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Output Result&quot; border=&quot;0&quot; height=&quot;78&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3ge9UGQqHTYJ5_WAlBrOnzp4Ib6nE7C1b0LIwW17vvVUnpLayGth_BBhWKqFLD3DGwxEfZh1BdJbzDdDfGktHgz3fvsY2vfXRwKQhTyAMPTRc0xYpGpPl81OcihAAA8FYHOhqKtaKPEYi/s1600/JavaResult2.jpg&quot; title=&quot;Output Result&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;The Result&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
Congratulations now you have done your second Java Program you are ready to learn more&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;
&lt;b&gt;NOTE: Click Download below to download sample project.&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/p/tutorials-downloads.html#j2&quot; target=&quot;_blank&quot;&gt;More Download Links&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;a href=&quot;http://adf.ly/DZu2c&quot;&gt;&lt;img alt=&quot;Download From FileFactory!&quot; src=&quot;http://www.filefactory.com/img/buttons/download/purple.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
Hope you enjoyed and&amp;nbsp;benefited from this tutorial please feel free to comment or ask about anything and more tutorials will be added.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
Thank you for reading and enjoy your day.&amp;nbsp;&lt;/div&gt;
&lt;a href=&quot;http://www.codeproject.com/&quot; rel=&quot;tag&quot; style=&quot;display: none;&quot;&gt;CodeProject&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://developware.blogspot.com/2012/10/java-for-beginners-part-2.html</link><author>noreply@blogger.com (M)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvUiRTZKujp0FzuZOR9upjVOJcSay0AfiddyT7XqkvYc8Ak3MG4sMlQ6xe1QK0QOML6nuV3IE6Z_AFnluPMz8F7yUCP47a2oUWoNP75BTABM8s5cDm2BJeNfn5Mprx29uxB0i2zXsFH3RZ/s72-c/project+type+java.jpg" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8947640765488864381.post-8710794790730746888</guid><pubDate>Mon, 08 Oct 2012 17:59:00 +0000</pubDate><atom:updated>2012-10-11T18:21:22.761+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C# Tutorials</category><category domain="http://www.blogger.com/atom/ns#">CodeProject</category><title>C# for beginners Part 2</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;h2&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Hello Me!&lt;/span&gt;&lt;/h2&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Welcome to your second C# for beginners tutorial, in this tutorial you will learn the simple hello Me program after you&#39;ve learned&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/2012/10/c-for-beginners-part-1.html&quot; target=&quot;_blank&quot;&gt;Hello World!&lt;/a&gt;.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;h3&gt;Things you will need:&lt;/h3&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Microsoft Visual Studio you can download the express edition for free from here&amp;nbsp;&lt;a href=&quot;http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-for-windows-desktop#product-express-desktop-details&quot; target=&quot;_blank&quot;&gt;free visual studio&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Read Hello World! if you didn&#39;t read it yet&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/2012/10/c-for-beginners-part-1.html&quot; target=&quot;_blank&quot;&gt;From here.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;10 minutes of your time.&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;&lt;h3&gt;Lets start:&lt;/h3&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Now that you ready to make your second program after installing Microsoft Visual Studio lets open it, now you will have to create a new project there is lots of project&#39;s types you can choose from but we will start with the simplest and very basic one of them the Console application.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;b&gt;File&amp;gt;&amp;gt;New&amp;gt;&amp;gt;Project&lt;/b&gt;&lt;/div&gt;&lt;div&gt;you will get a window similar to this (it may look different depending on the version of your Visual Studio)&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSFqT5hVYdb4YqdM4RTmtgytbDyt59Og_HhDBJB0SqvJulpwrTHq0LW1I3mzOhRap98GR2dvh1C8ryI97MNyDG7r7Ud2qAfaQ7YjZLaNIxJ-hJI9gSqwFXyxJnLIGBn2adZe78SBwsO-Ya/s1600/CSProject+type2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;New Project&quot; border=&quot;0&quot; height=&quot;226&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSFqT5hVYdb4YqdM4RTmtgytbDyt59Og_HhDBJB0SqvJulpwrTHq0LW1I3mzOhRap98GR2dvh1C8ryI97MNyDG7r7Ud2qAfaQ7YjZLaNIxJ-hJI9gSqwFXyxJnLIGBn2adZe78SBwsO-Ya/s320/CSProject+type2.jpg&quot; title=&quot;New Project&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Project Type&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Choose&amp;nbsp;&lt;b&gt;Visual C#&lt;/b&gt;&amp;nbsp;for the programming language then&amp;nbsp;&lt;b&gt;Console Application&lt;/b&gt;&amp;nbsp;for the program type.&lt;/div&gt;&lt;div&gt;For the name type HelloMe or whatever you like your program name to be, But in here I will be using HelloMe as the project name so its a good practice to do the same so that names wont make you confused.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Now that you created the project its time to start writing some codes, This is how your code will look like when you open Program.cs file&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;background-color: #ccccff;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System.Collections.Generic;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System.Linq;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System.Text;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;namespace&lt;/span&gt;&amp;nbsp;HelloMe&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #3d85c6;&quot;&gt;Program&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;static void&lt;/span&gt;&amp;nbsp;Main(&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;[] args)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Our program is very simple all we want to do is to make our program ask for your name and Then welcomes you by saying Hello Yourname! and to make the program read anything from the Console we use Console.ReadLine(); command we will also use variables in this program.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;&lt;b&gt;NOTE:&amp;nbsp;&lt;/b&gt;Variables are containers that hold our data temporary it has many types as we may need to store text or numbers or anything else&lt;br /&gt;
text = string &amp;nbsp; &amp;nbsp; &amp;nbsp; ex:&quot;This is sentence&quot;&lt;br /&gt;
number = int &amp;nbsp; &amp;nbsp; &amp;nbsp;ex: 1&lt;br /&gt;
point number = float or decimal &amp;nbsp; &amp;nbsp; &amp;nbsp; ex: 1.5&amp;nbsp;&lt;/div&gt;&lt;br /&gt;
Now lets make our program ask for your name and run it, In the Main type Console.WriteLine(&quot;What is your name?&quot;);&lt;br /&gt;
Then we need to get your name from the Console window so we will declare a variable called name of type string and put your name there first here is how to declare a variable of type string&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&amp;nbsp;name;&lt;/div&gt;&lt;br /&gt;
its as easy as that but we need &amp;nbsp;to tell our program to put your name in this variable because now we reserved a string space in our memory and never used it and this is how to tell your program to read your name from the Console window and put it in the variable name.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&amp;nbsp;name = &lt;span style=&quot;color: #3d85c6;&quot;&gt;Console&lt;/span&gt;.ReadLine();&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
now all we need to do is to display the welcome message which is simple as we learned before how to display any text on the Console window but there is a little thing we will add there because we want the program to say Hello Your name so this is done like this&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;Console&lt;/span&gt;.WriteLine(&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;Hello &quot; &lt;/span&gt;+ name + &lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;!&quot;&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
What the plus sign means is add the text in this variable from type string to that text in that position&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;&lt;b&gt;NOTE: &lt;/b&gt;Always remember to&amp;nbsp;&amp;nbsp;put space after hello because if you didnt it will be HelloYourname without spaces it doesnt matter how many spaces you put after the&amp;nbsp;quotation mark it will be ignored.&amp;nbsp;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Now this is how your final code will look like&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System.Collections.Generic;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System.Linq;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System.Text;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;namespace&lt;/span&gt;&amp;nbsp;HelloWorld&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #3d85c6;&quot;&gt;Program&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;static void&lt;/span&gt;&amp;nbsp;Main(&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;[] args)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #3d85c6;&quot;&gt;Console&lt;/span&gt;.WriteLine(&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;What is your name?&quot;&lt;/span&gt;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&amp;nbsp;name =&amp;nbsp;&lt;span style=&quot;color: #3d85c6;&quot;&gt;Console&lt;/span&gt;.ReadLine();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #3d85c6;&quot;&gt;Console&lt;/span&gt;.WriteLine(&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;Hello &quot;&amp;nbsp;&lt;/span&gt;+ name +&amp;nbsp;&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;!&quot;&lt;/span&gt;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;/div&gt;&lt;br /&gt;
Now lets Run our program and see what we did press&amp;nbsp;&lt;b&gt;Ctrl+F5&lt;/b&gt;&amp;nbsp;to run your program&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVY4yCrHvRmRkDG_9nuZFEgHZebuWGtzBZMSUeaEkoErbnvpBSEkRTdhJGHr0Xc1-RNTG09oZU0maXEjv-LEqe3b9y7iilZr2h_HMPgP_8sqHRSMp3MqkPE6eP1cUu99CFEo-X5atJfZOW/s1600/CSResult2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Console Result&quot; border=&quot;0&quot; height=&quot;162&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVY4yCrHvRmRkDG_9nuZFEgHZebuWGtzBZMSUeaEkoErbnvpBSEkRTdhJGHr0Xc1-RNTG09oZU0maXEjv-LEqe3b9y7iilZr2h_HMPgP_8sqHRSMp3MqkPE6eP1cUu99CFEo-X5atJfZOW/s320/CSResult2.jpg&quot; title=&quot;Console Result&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;The Result&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;Congratulations now you have done your second C# Program you are ready to learn more&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #ffff66;&quot;&gt;&lt;b&gt;NOTE: Click Download below to download sample project.&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/p/tutorials-downloads.html#CS2&quot; target=&quot;_blank&quot;&gt;More Download Links&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;a href=&quot;http://adf.ly/DWMjT&quot;&gt;&lt;img alt=&quot;Download From FileFactory!&quot; src=&quot;http://www.filefactory.com/img/buttons/download/purple.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;Hope you enjoyed and&amp;nbsp;benefited from this tutorial please feel free to comment or ask about anything and more tutorials will be added.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;Thank you for reading and enjoy your day.&amp;nbsp;&lt;/div&gt;&lt;a href=&quot;http://www.codeproject.com&quot; rel=&quot;tag&quot; style=&quot;display:none&quot;&gt;CodeProject&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</description><link>http://developware.blogspot.com/2012/10/c-for-beginners-part-2.html</link><author>noreply@blogger.com (M)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSFqT5hVYdb4YqdM4RTmtgytbDyt59Og_HhDBJB0SqvJulpwrTHq0LW1I3mzOhRap98GR2dvh1C8ryI97MNyDG7r7Ud2qAfaQ7YjZLaNIxJ-hJI9gSqwFXyxJnLIGBn2adZe78SBwsO-Ya/s72-c/CSProject+type2.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8947640765488864381.post-3551806404186141503</guid><pubDate>Sat, 06 Oct 2012 17:48:00 +0000</pubDate><atom:updated>2012-10-11T18:21:33.890+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">CodeProject</category><category domain="http://www.blogger.com/atom/ns#">Java Tutorials</category><title>Java for beginners Part 1</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Hello World!&lt;/h2&gt;&lt;div&gt;Welcome to your first of all Java for beginners tutorial, in this tutorial you will learn the simple hello world program to start learning Java.&lt;/div&gt;&lt;div&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;h3&gt;Things you will need:&lt;/h3&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Java you can download it if it isn&#39;t already installed from Java official site&amp;nbsp;&lt;a href=&quot;http://www.java.com/en/&quot; target=&quot;_blank&quot;&gt;free Java.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;NetBeans you can download it for free from NetBeans official site&amp;nbsp;&lt;a href=&quot;http://netbeans.org/&quot; target=&quot;_blank&quot;&gt;free NetBeans.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;10 minutes of your time.&lt;/li&gt;
&lt;/ol&gt;&lt;div style=&quot;background-color: #ffff66;&quot;&gt;&lt;b&gt;NOTE: &lt;/b&gt;Its&amp;nbsp;advised&amp;nbsp;to download and install Java &lt;b&gt;before &lt;/b&gt;installing NetBeans.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;h3&gt;&lt;/h3&gt;&lt;h3&gt;Lets start:&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;Now that you ready to make your first program after installing Java and NetBeans lets open NetBeans, now you will have to create a new project there is lots of project&#39;s types you can choose from but we will start with the simplest and very basic one of them the Java application.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;b&gt;File&amp;gt;&amp;gt;New Project&lt;/b&gt;&lt;/div&gt;&lt;div&gt;you will get a window similar to this (it may look different depending on the version of your NetBeans and other installed programs you have or&amp;nbsp;have not)&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvUiRTZKujp0FzuZOR9upjVOJcSay0AfiddyT7XqkvYc8Ak3MG4sMlQ6xe1QK0QOML6nuV3IE6Z_AFnluPMz8F7yUCP47a2oUWoNP75BTABM8s5cDm2BJeNfn5Mprx29uxB0i2zXsFH3RZ/s1600/project+type+java.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;New Project&quot; border=&quot;0&quot; height=&quot;275&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvUiRTZKujp0FzuZOR9upjVOJcSay0AfiddyT7XqkvYc8Ak3MG4sMlQ6xe1QK0QOML6nuV3IE6Z_AFnluPMz8F7yUCP47a2oUWoNP75BTABM8s5cDm2BJeNfn5Mprx29uxB0i2zXsFH3RZ/s400/project+type+java.jpg&quot; title=&quot;New Project&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Project Type&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div&gt;Choose&amp;nbsp;&lt;b&gt;Java&lt;/b&gt;&amp;nbsp;for the Categories then&amp;nbsp;&lt;b&gt;Java Application&lt;/b&gt;&amp;nbsp;for the Projects then &lt;b&gt;Next&amp;gt;&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7yzNbhX4RJ8w8b7BB2CY-hzzu0ihoWQMH7jrITEsvVCsLO76GZIDntGmLpIIRMHe51mJ51xPDqNP4ZnF-5MQAZ9y4BMX3gZuIWzIqUIKtV7sNi8nRtH5gzfYMSEZNZlBBmNDkvJEjY9dc/s1600/project+name+java.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Project Name&quot; border=&quot;0&quot; height=&quot;273&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7yzNbhX4RJ8w8b7BB2CY-hzzu0ihoWQMH7jrITEsvVCsLO76GZIDntGmLpIIRMHe51mJ51xPDqNP4ZnF-5MQAZ9y4BMX3gZuIWzIqUIKtV7sNi8nRtH5gzfYMSEZNZlBBmNDkvJEjY9dc/s400/project+name+java.jpg&quot; title=&quot;Project Name&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Project Name&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;For the name type HelloWorld or whatever you like your program name to be, But in here I will be using HelloWorld as the project name so its a good practice to do the same so that names wont make you confused.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;Now that you created the project its time to start writing some codes, This is how your code will look like when you open HelloWorld.java file&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;background-color: #ccccff;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;/*&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* To change this template, choose Tools | Templates&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* and open the template in the editor.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;package &lt;/span&gt;helloworld;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;color: #999999;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* @author YourName&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;public class &lt;/span&gt;&lt;b&gt;HelloWorld&lt;/b&gt; {&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* @param args the command line arguments&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; public static void &lt;/span&gt;&lt;b&gt;main&lt;/b&gt;(String[] args) {&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;// TODO code application logic here&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt; }&lt;br /&gt;
}&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
Our program is very simple all we want to do is to make our program say Hello World! and to type anything on the Output window you will have to use System.out.print(&quot;whatever you want to type&quot;); or System.out.println(&quot;whatever you want to type&quot;);&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;&lt;b&gt;NOTE:&amp;nbsp;&lt;/b&gt;The different between both is that print types what you want then stops at the same line so if you typed anything else it will continue in the same line but println stops at the new line after what you typed&amp;nbsp;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;&lt;b&gt;NOTE:&amp;nbsp;&lt;/b&gt;System.out.print(&quot;Hello World! \n&quot;); is the same as System.out.println(&quot;Hello World!&quot;);&lt;br /&gt;
you can read more about \n in&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/2012/10/famous-sequences.html&quot; target=&quot;_blank&quot;&gt;escape sequences&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style=&quot;color: black;&quot;&gt;Now lets make our program say Hello World! and run it, In the Main type System.out.print(&quot;Hello World!&quot;);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #ccccff;&quot;&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/*&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* To change this template, choose Tools | Templates&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* and open the template in the editor.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;package&amp;nbsp;&lt;/span&gt;helloworld;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;color: #999999;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;* @author YourName&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;public class&amp;nbsp;&lt;/span&gt;&lt;b&gt;HelloWorld&lt;/b&gt;&amp;nbsp;{&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* @param args the command line arguments&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; public static void&amp;nbsp;&lt;/span&gt;&lt;b&gt;main&lt;/b&gt;(String[] args) {&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;// TODO code application logic here&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;System.&lt;span style=&quot;color: #38761d;&quot;&gt;out&lt;/span&gt;.print(&lt;span style=&quot;color: #e69138;&quot;&gt;&quot;Hello World!&quot;&lt;/span&gt;);&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&amp;nbsp;}&lt;br /&gt;
}&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
Now lets Run our program and see what we did press&amp;nbsp;&lt;b&gt;F6&lt;/b&gt;&amp;nbsp;to run your program.&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjI5wx553rcrWEeOouZlwTkTBtWkb3Uie-JDR9h5mHk5GhIZrZUZ81gSTkEuwj7pZ7D-HqZjPwJ0TyocCFtisJQlT8sFyTtqpmCJ6h31-xMkt6AOUrU3-S8tSs-boQdaq2MfgpcFAUIswqi/s1600/Result+Java.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Output Result&quot; border=&quot;0&quot; height=&quot;78&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjI5wx553rcrWEeOouZlwTkTBtWkb3Uie-JDR9h5mHk5GhIZrZUZ81gSTkEuwj7pZ7D-HqZjPwJ0TyocCFtisJQlT8sFyTtqpmCJ6h31-xMkt6AOUrU3-S8tSs-boQdaq2MfgpcFAUIswqi/s400/Result+Java.jpg&quot; title=&quot;Output Result&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;The Result&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;Congratulations now you have done your first Java Program you are ready to learn more&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;&lt;b&gt;NOTE: Click Download below to download sample project.&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/p/tutorials-downloads.html#j1&quot; target=&quot;_blank&quot;&gt;More Download Links&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;a href=&quot;http://adf.ly/DUrn7&quot;&gt;&lt;img alt=&quot;Download From FileFactory!&quot; src=&quot;http://www.filefactory.com/img/buttons/download/purple.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;Hope you enjoyed and&amp;nbsp;benefited from this tutorial please feel free to comment or ask about anything and more tutorials will be added.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;Thank you for reading and enjoy your day.&amp;nbsp;&lt;/div&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.codeproject.com&quot; rel=&quot;tag&quot; style=&quot;display:none&quot;&gt;CodeProject&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</description><link>http://developware.blogspot.com/2012/10/java-for-beginners-part-1.html</link><author>noreply@blogger.com (M)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvUiRTZKujp0FzuZOR9upjVOJcSay0AfiddyT7XqkvYc8Ak3MG4sMlQ6xe1QK0QOML6nuV3IE6Z_AFnluPMz8F7yUCP47a2oUWoNP75BTABM8s5cDm2BJeNfn5Mprx29uxB0i2zXsFH3RZ/s72-c/project+type+java.jpg" height="72" width="72"/><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8947640765488864381.post-1861740177844246314</guid><pubDate>Thu, 04 Oct 2012 16:04:00 +0000</pubDate><atom:updated>2012-10-11T18:22:06.700+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C# Tutorials</category><category domain="http://www.blogger.com/atom/ns#">CodeProject</category><category domain="http://www.blogger.com/atom/ns#">Java Tutorials</category><title>Famous &#39;\&#39; sequences</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Special use for &#39;\&#39; sequences&lt;/h2&gt;&lt;div&gt;In C# and Java there is a lot of uses for \ so here is some of the famous sequences you&#39;ll need to know in order to be able to use them.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;table border=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td align=&quot;center&quot; width=&quot;100&quot;&gt;&lt;br /&gt;
\n&lt;/td&gt; &lt;td align=&quot;center&quot;&gt;&lt;br /&gt;
New line&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td align=&quot;center&quot; width=&quot;100&quot;&gt;&lt;br /&gt;
\t&lt;/td&gt; &lt;td align=&quot;center&quot;&gt;&lt;br /&gt;
Tab = wide white space&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td align=&quot;center&quot; width=&quot;100&quot;&gt;&lt;br /&gt;
\&#39;&lt;/td&gt; &lt;td align=&quot;center&quot;&gt;&lt;br /&gt;
Single quotation mark&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td align=&quot;center&quot; width=&quot;100&quot;&gt;&lt;br /&gt;
\&quot;&lt;/td&gt; &lt;td align=&quot;center&quot;&gt;&lt;br /&gt;
Double quotation mark&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td align=&quot;center&quot; width=&quot;100&quot;&gt;&lt;br /&gt;
\\&lt;/td&gt; &lt;td align=&quot;center&quot;&gt;&lt;br /&gt;
Backslash&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;background-color: #ffff66;&quot;&gt;&lt;b&gt;NOTE: &lt;/b&gt;Any character from above characters and any others that consist of &#39;\&#39;+a character or sequence of characters called Escape Sequences.&lt;/div&gt;&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;Read more about this&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;You can find useful and more clear explanation about the escape sequences on&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/Escape_sequence&quot; target=&quot;_blank&quot;&gt;wikipedia&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;You can also see&amp;nbsp;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/h21280bw(v=vs.80).aspx&quot; target=&quot;_blank&quot;&gt;Microsoft MSDN&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;Please feel free to ask or comment.&lt;/div&gt;&lt;div&gt;Thank you for reading and enjoy your day.&lt;/div&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.codeproject.com&quot; rel=&quot;tag&quot; style=&quot;display:none&quot;&gt;CodeProject&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</description><link>http://developware.blogspot.com/2012/10/famous-sequences.html</link><author>noreply@blogger.com (M)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8947640765488864381.post-6759426693466378806</guid><pubDate>Tue, 02 Oct 2012 22:05:00 +0000</pubDate><atom:updated>2012-10-11T18:16:38.187+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C# Tutorials</category><category domain="http://www.blogger.com/atom/ns#">CodeProject</category><title>C# for beginners Part 1</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Hello World!&lt;/span&gt;&lt;/h2&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Welcome to your first of all C# for beginners tutorial, in this tutorial you will learn the simple hello world program to start learning C#.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Things you will need:&lt;/h3&gt;&lt;div&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Microsoft Visual Studio you can download the express edition for free from here&amp;nbsp;&lt;a href=&quot;http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-for-windows-desktop#product-express-desktop-details&quot; target=&quot;_blank&quot;&gt;free visual studio&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;10 minutes of your time.&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Lets start:&lt;/h3&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Now that you ready to make your first program after installing Microsoft Visual Studio lets open it, now you will have to create a new project there is lots of project&#39;s types you can choose from but we will start with the simplest and very basic one of them the Console application.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;b&gt;File&amp;gt;&amp;gt;New&amp;gt;&amp;gt;Project&lt;/b&gt;&lt;/div&gt;&lt;div&gt;you will get a window similar to this (it may look different depending on the version of your Visual Studio)&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtGVi1dqJaNDtgU2GollKjKVr10KEX96_-yrnxeVMN0775W5ffReewpwgK_T-pt8ppFaPOwsqsQ0vA4LO9UucdKLyeuVg_KNHiF4jpPfgvv0mYlyIKDsrGrW-zjNF3DUGCLZgau3pbeBse/s1600/project+type.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;New Project&quot; border=&quot;0&quot; height=&quot;282&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtGVi1dqJaNDtgU2GollKjKVr10KEX96_-yrnxeVMN0775W5ffReewpwgK_T-pt8ppFaPOwsqsQ0vA4LO9UucdKLyeuVg_KNHiF4jpPfgvv0mYlyIKDsrGrW-zjNF3DUGCLZgau3pbeBse/s400/project+type.jpg&quot; title=&quot;New Project&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Project Type&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Choose &lt;b&gt;Visual C#&lt;/b&gt; for the programming language then &lt;b&gt;Console Application&lt;/b&gt; for the program type.&lt;/div&gt;&lt;div&gt;For the name type HelloWorld or whatever you like your program name to be, But in here I will be using HelloWorld as the project name so its a good practice to do the same so that names wont make you confused.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Now that you created the project its time to start writing some codes, This is how your code will look like when you open Program.cs file&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;background-color: #ccccff;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt; System;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt; System.Collections.Generic;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt; System.Linq;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt; System.Text;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;namespace&lt;/span&gt; HelloWorld&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #3d85c6;&quot;&gt;Program&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;static void&lt;/span&gt; Main(&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;[] args)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Our program is very simple all we want to do is to make our program say Hello World! and to type anything on the Console window you will have to use Console.Write(&quot;whatever you want to type&quot;); or Console.WriteLine(&quot;whatever you want to type&quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;&lt;b&gt;NOTE: &lt;/b&gt;The different between both is that Write types what you want then stops at the same line so if you typed anything else it will continue in the same line but WriteLine stops at the new line after what you typed&amp;nbsp;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: #ffff66;&quot;&gt;&lt;b&gt;NOTE: &lt;/b&gt;Console.Write(&quot;Hello World! \n&quot;); is the same as Console.WriteLine(&quot;Hello World!&quot;);&lt;br /&gt;
you can read more about \n in&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/2012/10/famous-sequences.html&quot; target=&quot;_blank&quot;&gt;escape sequences&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Now lets make our program say Hello World! and run it, In the Main type Console.WriteLine(&quot;Hello World!&quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt; System;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt; System.Collections.Generic;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt; System.Linq;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt; System.Text;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;namespace&lt;/span&gt; HelloWorld&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #3d85c6;&quot;&gt;Program&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;static void&lt;/span&gt; Main(&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;[] args)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #3d85c6;&quot;&gt;Console&lt;/span&gt;.WriteLine(&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;Hello World!&quot;&lt;/span&gt;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;/div&gt;&lt;br /&gt;
Now lets Run our program and see what we did press &lt;b&gt;Ctrl+F5&lt;/b&gt;&amp;nbsp;to run your program&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXPGQCh_SMtkvQWGi4Katn0Ew2406oidWACXJAXn1vM8rusu00HnYg5RFbaZ6VAbiL4A67yzn6nCLepSLdbbp4jegmRpUuQRTh3AXBSvbSvDhAH1ViUMVbG7-YskVI2WyVIsqMMhIw1RFp/s1600/Result.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Console Result&quot; border=&quot;0&quot; height=&quot;202&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXPGQCh_SMtkvQWGi4Katn0Ew2406oidWACXJAXn1vM8rusu00HnYg5RFbaZ6VAbiL4A67yzn6nCLepSLdbbp4jegmRpUuQRTh3AXBSvbSvDhAH1ViUMVbG7-YskVI2WyVIsqMMhIw1RFp/s400/Result.jpg&quot; title=&quot;Console Result&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;The Result&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Congratulations now you have done your first C# Program you are ready to learn more&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #ffff66;&quot;&gt;&lt;b&gt;NOTE: Click Download below to download sample project.&amp;nbsp;&lt;a href=&quot;http://developware.blogspot.com/p/tutorials-downloads.html#CS1&quot; target=&quot;_blank&quot;&gt;More Download Links&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;a href=&quot;http://adf.ly/DWGOh&quot;&gt;&lt;img alt=&quot;Download From FileFactory!&quot; src=&quot;http://www.filefactory.com/img/buttons/download/purple.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Hope you enjoyed and&amp;nbsp;benefited from this tutorial please feel free to comment or ask about anything and more tutorials will be added.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Thank you for reading and enjoy your day.&amp;nbsp;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</description><link>http://developware.blogspot.com/2012/10/c-for-beginners-part-1.html</link><author>noreply@blogger.com (M)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtGVi1dqJaNDtgU2GollKjKVr10KEX96_-yrnxeVMN0775W5ffReewpwgK_T-pt8ppFaPOwsqsQ0vA4LO9UucdKLyeuVg_KNHiF4jpPfgvv0mYlyIKDsrGrW-zjNF3DUGCLZgau3pbeBse/s72-c/project+type.jpg" height="72" width="72"/><thr:total>2</thr:total></item></channel></rss>