<p>In this article, We will learn how to start with Java Programming and will write a small print &#8220;Hello World&#8221; program.</p>
<h3><span style="color: #000080;"><strong>Steps:</strong> </span></h3>
<ol>
<li>IDE (Java Editor) installation</li>
<li>Writing Hello World Java program.</li>
</ol>
<h3></h3>
<h3><span style="color: #000080;"><strong>Java Editor</strong></span></h3>
<p class="p1">To write Java programs, you will need a text editor. There are different IDEs (Integrated Development Environment) available in the market like Eclipse, Netbeans or IntelliJ IDEA, which are particularly useful when managing larger collections of Java files.</p>
<ul class="ul1">
<li class="li1"><span style="color: #0000ff;"><b>Netbeans</b></span> − A Java IDE that is open-source and free which can be downloaded from <strong><span style="color: #008000;"><a style="color: #008000;" href="https://www.netbeans.org/index.html"><span class="s2">https://www.netbeans.org/index.html</span></a></span></strong>.</li>
<li class="li1"><span style="color: #0000ff;"><b>Eclipse</b></span> − A Java IDE developed by the eclipse open-source community and can be downloaded from <strong><span style="color: #008000;"><a style="color: #008000;" href="https://www.eclipse.org/"><span class="s2">https://www.eclipse.org/</span></a></span></strong>.</li>
<li><span style="color: #0000ff;"><b>IntelliJ IDEA</b> </span>− A Java IDE developed by JetBrains and it&#8217;s free and open-source which can be downloaded from <strong><span style="color: #008000;"><a style="color: #008000;" href="https://www.jetbrains.com/idea/">https://www.jetbrains.com/idea/</a></span></strong>.</li>
</ul>
<p>I will prefer to use the <span style="color: #008000;"><b><span style="color: #008000;">IntelliJ IDEA </span> </b><span style="color: #333333;">Community version</span></span><b>. </b>Now go to the above-mentioned link to download <strong>IntelliJ</strong><b><span style="color: #008000;"><span style="color: #000000;"> IDEA</span></span></b><span style="color: #008000;"><span style="color: #000000;"> and install</span></span><span style="color: #008000;">.</span></p>
<h3><span style="color: #000080;"><strong>Creating a New Project in IntelliJ IDEA</strong></span></h3>
<p><strong>1</strong>. After installation the IntelliJ platform looks like this:</p>
<p><img class="alignnone size-full wp-image-1605" src="https://c1ctech.com/wp-content/uploads/2020/03/Screenshot-2020-03-04-12.20.31-1105199846-1583316146673.png" alt="Screenshot 2020-03-04 12.20.31" width="1322" height="954" /></p>
<p><strong>2</strong>. Click on <span style="color: #008000;"><strong>Create New Project</strong></span>.</p>
<p><img class="alignnone size-full wp-image-1606" src="https://c1ctech.com/wp-content/uploads/2020/03/Screenshot-2020-03-04-12.21.23-239678958-1583316194966.png" alt="Screenshot 2020-03-04 12.21.23" width="2407" height="1435" /></p>
<p><strong>3</strong>. I am going to create Java projects so I will select <strong><span style="color: #008000;">Java</span></strong> from the available left side options and then click <strong><span style="color: #008000;">Next</span></strong>.</p>
<p><strong>4</strong> . Now give your project a name and then click on <strong><span style="color: #008000;">finish</span></strong>.</p>
<p><strong>5</strong> . Inside the <span style="color: #008000;"><strong>src</strong></span> folder, to create a new java file right-click and then select <strong><span style="color: #008000;">New</span></strong> then <strong><span style="color: #008000;">Java Class</span></strong>.</p>
<p><img class="alignnone wp-image-1631" src="https://c1ctech.com/wp-content/uploads/2020/03/Screenshot-2020-03-06-16.35.32.png" alt="Screenshot 2020-03-06 16.35.32" width="559" height="203" /></p>
<p> ;</p>
<p><strong>6</strong>. Now named the class which you want In my case I will name it as <span style="color: #008000;"><strong>HelloWorld</strong></span>.</p>
<p><img class="alignnone wp-image-1632" src="https://c1ctech.com/wp-content/uploads/2020/03/Screenshot-2020-03-06-17.05.36-3294088077-1583494606254.png" alt="Screenshot 2020-03-06 17.05.36" width="443" height="232" /></p>
<p><strong>7</strong>. Inside the <strong><span style="color: #008000;">HelloWorld.java</span></strong> file, I will write the following code to print &#8220;Hello, World!&#8221; to the screen:</p>
<p><span style="color: #0000ff;"><b>Java &#8220;Hello, World!&#8221; Program</b></span></p>
<pre>public class HelloWorld {

 public static void main(String[] args) {
 System.out.println("Hello, World!");
 }
}</pre>
<p><strong>8</strong> . Run the program using the <strong><span style="color: #008000;">Run</span></strong> button.</p>
<p><img class="alignnone wp-image-1614" src="https://c1ctech.com/wp-content/uploads/2020/03/Screenshot-2020-03-06-12.21.31.png" alt="Screenshot 2020-03-06 12.21.31" width="548" height="121" /></p>
<p>When you run the program, You can see the output of the program in the Console screen, the output will be:</p>
<!-- WP QUADS Content Ad Plugin v. 2.0.98.1 -->
<div class="quads-location quads-ad2" id="quads-ad2" style="float:none;margin:0px;">

</div>

<p><img class="alignnone wp-image-1616" src="https://c1ctech.com/wp-content/uploads/2020/03/Screenshot-2020-03-06-12.45.56.png" alt="Screenshot 2020-03-06 12.45.56" width="594" height="166" /></p>
<h3><span style="color: #000080;"><strong>Understanding Code:</strong></span></h3>
<p>Let&#8217;s understand how &#8220;Hello, World!&#8221; program works in Java.</p>
<p><strong>1</strong> . <span style="color: #008000;"><strong>public class HelloWorld { &#8230; }</strong></span></p>
<p>In Java, every application begins with a class definition. In the program, <strong><span style="color: #008000;">HelloWorld </span></strong><span style="color: #008000;"><span style="color: #000000;">is the name of the class and class definition is:</span></span>.</p>
<pre>public class HelloWorld {
....
}</pre>
<p>For now, just remember that every Java application has a class definition, and the name of the class should match the filename in Java.</p>
<p>This above line declares a class named <strong><span style="color: #008000;">HelloWorld</span></strong>, which is public, which means that any other class can access it.</p>
<h4><span style="color: #0000ff;"><strong>Notes:</strong></span></h4>
<ol>
<li>A class should always start with an uppercase first letter. For example, if you want to name your class as helloworldexample you have to write like this <strong><span style="color: #008000;">HelloWorldExample</span></strong>.</li>
<li>Java is <strong><span style="color: #008000;">case-sensitive</span></strong>: means It will treat &#8220;HelloWorld&#8221; and &#8220;helloworld&#8221; differently.</li>
<li class="p1">When we declare a public class (HelloWorld), we must declare it inside a file with the same name (HelloWorld.java), otherwise we&#8217;ll get an error when compiling.</li>
</ol>
<h4></h4>
<h4><span style="color: #000080;"><strong>The main Method</strong></span></h4>
<p class="p1"><strong>2</strong> . <span style="color: #008000;"><strong>public static void main(String args[]){ }</strong></span></p>
<p class="p1">This is the main method. Every application in Java must contain the main method.</p>
<p class="p1">The main method is the entry point of our Java program which means It tells the compiler to start executing the code from here.</p>
<p class="p1">The main method must have this exact signature in order to be able to run our program.</p>
<pre>public static void main(String... args){
 ...
}</pre>
<ul class="ul1">
<li class="li1"><span style="color: #008000;"><strong>public</strong></span> means that anyone can access it.</li>
<li class="li1"><strong><span style="color: #008000;">static</span></strong> means that you can run this method without creating an instance of HelloWorld class.</li>
<li class="li1"><strong><span style="color: #008000;">void</span></strong> means that this method doesn&#8217;t return any value.</li>
<li class="li1"><strong><span style="color: #008000;">main</span></strong> is the name of the method.</li>
<li>The main method takes <strong><span style="color: #008000;">array of String</span></strong> as an argument which you can specify with any name and with any of the following syntax :</li>
</ul>
<pre>String[] args or</pre>
<pre>String args[]</pre>
<p><strong>3</strong> . <strong><span style="color: #008000;">System.out.println(&#8220;Hello World&#8221;);</span></strong></p>
<p>The following code prints the string inside quotation marks <strong><span style="color: #0000ff;">Hello, World!</span></strong> to standard output (your screen).</p>
<ul class="ul1">
<li class="li1"><strong><span style="color: #008000;">System</span></strong> is a pre-defined class that Java provides us and it holds some useful methods and variables.</li>
<li class="li1"><strong><span style="color: #008000;">out</span></strong> is a static variable within <span style="color: #008000;"><strong>System</strong></span> that represents the output of your program (stdout).</li>
<li class="li1"><strong><span style="color: #008000;">println </span></strong>method is an upgraded version of <strong><span style="color: #008000;">print()</span></strong> inside <strong><span style="color: #008000;">PrintStream</span></strong> which prints any argument passed to it on the screen and adds a new line to the output. In this program, it will print Hello, World! and add a new line.</li>
</ul>
<p><span style="color: #0000ff;"><strong>Note:</strong> </span>Each code statement must end with a semicolon.</p>
<p>There is no need to worry about <strong><span style="color: #008000;">class, static, modifier(public)</span></strong> we will talk about it later in detail.</p>
<h3><span style="color: #000080;"><strong>Conclusion</strong></span></h3>
<p>For now, just remember the below points:</p>
<p>1 .Every Java application has a class definition, and if the class is public then it is mandatory that the name of the class should match with the Java file name.</p>
<p>2 .Every application in Java must contain the main method which tells the compiler to start executing the code from here.</p>
<p> ;</p>


