<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Alon Klein</title>
    <description>The latest articles on Forem by Alon Klein (@kleinalon).</description>
    <link>https://forem.com/kleinalon</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F942146%2F63b9853b-08ff-44c7-a89f-353bc6d01f1e.png</url>
      <title>Forem: Alon Klein</title>
      <link>https://forem.com/kleinalon</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/kleinalon"/>
    <language>en</language>
    <item>
      <title>Introduction to Java!</title>
      <dc:creator>Alon Klein</dc:creator>
      <pubDate>Wed, 30 Nov 2022 15:12:02 +0000</pubDate>
      <link>https://forem.com/kleinalon/introduction-to-java-4041</link>
      <guid>https://forem.com/kleinalon/introduction-to-java-4041</guid>
      <description>&lt;p&gt;"JAVA was developed by Sun Microsystems Inc in 1991, later acquired by Oracle Corporation. It was developed by James Gosling and Patrick Naughton. It is a simple programming language.  Writing, compiling and debugging a program is easy in java.  It helps to create modular programs and reusable code."&lt;/p&gt;




&lt;h2&gt;
  
  
  Welcome to Java.
&lt;/h2&gt;

&lt;p&gt;In this tutorial, you will learn to write "Hello World" program in Java.&lt;/p&gt;

&lt;p&gt;A "Hello, World!" is a simple program that outputs &lt;code&gt;Hello, World!&lt;/code&gt; on the screen. Since it's a very simple program, it's often used to introduce a new programming language to a newbie.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Your First Program&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;HelloWorld&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello World!"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hello, World!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  So how it is works?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;//Your First Program&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In Java, any line starting with &lt;code&gt;//&lt;/code&gt; is a comment.&lt;br&gt;
Comments are intended for users reading the code to understand the intent and functionality of the program. It is completely ignored by the Java compiler.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;public class HelloWorld{...}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In Java, every application begins with a class definition. It is depends on your file name, for example your file name will be &lt;code&gt;Hello.java&lt;/code&gt; so the class has to be called "Hello".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Hello&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Class Definition&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;code&gt;public static void main(String[] args) {...}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the main method. Every application in Java must contain the main method. The Java compiler starts executing the code from the main method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Main Method&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;code&gt;System.out.println("Hello, World!");&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The code above is a print statement. It prints the text &lt;code&gt;Hello, World!&lt;/code&gt; to standard output (your screen). &lt;/p&gt;

</description>
      <category>api</category>
      <category>webdev</category>
      <category>backend</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
