<?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>DEV Community: CodeStorm</title>
    <description>The latest articles on DEV Community by CodeStorm (@codestorm12).</description>
    <link>https://dev.to/codestorm12</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%2F2830317%2Fd156de4a-9fec-47a2-ba03-c944799754eb.JPG</url>
      <title>DEV Community: CodeStorm</title>
      <link>https://dev.to/codestorm12</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/codestorm12"/>
    <language>en</language>
    <item>
      <title>Understanding the Java Main method.</title>
      <dc:creator>CodeStorm</dc:creator>
      <pubDate>Sun, 09 Feb 2025 12:54:12 +0000</pubDate>
      <link>https://dev.to/codestorm12/understanding-the-java-main-method-4ilp</link>
      <guid>https://dev.to/codestorm12/understanding-the-java-main-method-4ilp</guid>
      <description>&lt;p&gt;Writing your first Java "Hello World" application is pretty exciting. When you start your Java journey, you are told this is the syntax to write the program, and you just go along with it. Today, we will break down the reasons behind the main method of your Java code.&lt;/p&gt;

&lt;p&gt;Let's consider the following "Hello World" code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class HelloWorld{
    public static void main(String[] args) {

    System.out.println("Hello - " +args[0]+" "+args[1]);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It has three main components: a class "Helloworld", a public method "main", and an array of strings "args".&lt;/p&gt;

&lt;p&gt;1.The keyword &lt;strong&gt;class&lt;/strong&gt; defines your Java class. As an object-oriented language, everything must be inside a class. It can have any name as long as your file name is the same. This tells the JRE which class to look for.&lt;/p&gt;

&lt;p&gt;2.Then comes your &lt;strong&gt;main&lt;/strong&gt; method. It has to be named "main" for the JRE to recognize it, as it calls the main method to execute your program.&lt;/p&gt;

&lt;p&gt;Breaking down the method signature:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;public&lt;/strong&gt; – Access specifier. It has to be public for the JRE to call the function. Other access modifiers include private and protected, which cannot be called from outside the class.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;static&lt;/strong&gt; – The static keyword defines the method as a static method, meaning the JRE can call this method without creating an object of your class.&lt;br&gt;
i.e instead of this  -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HelloWorld obj = new HelloWorld();
obj.main(args);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;it can directly call this -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HelloWorld.main(args);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;void&lt;/strong&gt; – The return type of your program. This has to be void so that when your program finishes, it actually terminates and returns nothing.&lt;/p&gt;

&lt;p&gt;3.The parameter &lt;strong&gt;String[] args&lt;/strong&gt; – This is called command-line arguments. Just like you pass information to methods inside the program, you can pass values to your main program as an array of arguments (you can call it "args" or literally any variable name).&lt;/p&gt;

&lt;p&gt;Example on how to use it (use space to give multiple arguments):&lt;/p&gt;

&lt;p&gt;&lt;em&gt;java myprogram arg1 arg2&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;java HelloWorld There,General Kenobi&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;will give output - &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6z7n8v241uactdvcienf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6z7n8v241uactdvcienf.png" alt="Output with command line arguments" width="231" height="28"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are using eclipse you can pass this arguments in configuration option - &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu9m0vwn6zuexn36kmwlg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu9m0vwn6zuexn36kmwlg.png" alt="passing commandline arguments in Eclipse" width="775" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>java</category>
      <category>basic</category>
      <category>beginners</category>
    </item>
    <item>
      <title>JDK, JVM, JRE Explained – What Every Java Developer Should Know</title>
      <dc:creator>CodeStorm</dc:creator>
      <pubDate>Sat, 08 Feb 2025 13:12:11 +0000</pubDate>
      <link>https://dev.to/codestorm12/jdk-jvm-jre-explained-what-every-java-developer-should-know-13bp</link>
      <guid>https://dev.to/codestorm12/jdk-jvm-jre-explained-what-every-java-developer-should-know-13bp</guid>
      <description>&lt;p&gt;When you dive into Java for the first time, you come across three terms instantly before you even start programming. Knowing what  JDK, JRE, and JVM are is essential to every Java developer. Simply googling these three terms will give you thousands of definitions and explanations of what they are and how they work. In this post, we will try to learn these three things in the simplest way possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.JVM (Java Virtual Machine)&lt;/strong&gt;&lt;br&gt;
We know that Java lets programmers &lt;em&gt;write once, run anywhere&lt;/em&gt; &lt;strong&gt;(WORA)&lt;/strong&gt;, or &lt;em&gt;Write once, and run everywhere&lt;/em&gt; &lt;strong&gt;(WORE)&lt;/strong&gt;. This illustrates one of the core features of Java being cross-platform or platform-independent. How does this happen?&lt;/p&gt;

&lt;p&gt;When you write your Java code and compile it it turns the code into bytecode which is an intermediary between human-readable and machine-readable code. Now this code can be run on any platform that has JVM. &lt;/p&gt;

&lt;p&gt;-JVM converts this bytecode into machine-readable code.&lt;br&gt;
-It runs the programs and takes care of all the background stuff users should not worry about.&lt;br&gt;
-JVM is a subset and part of JRE and JDK as we will learn further. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.JRE (Java Runtime Environment)&lt;/strong&gt;&lt;br&gt;
JRE is the basic requirement needed in a system to run a Java application.JRE consists of JVM and its supported standard library classes which are required to run the application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.JDK (Java Development Kit)&lt;/strong&gt;&lt;br&gt;
JDK is the software development kit containing all your development tools required to write, compile, debug, and run a Java program. It contains a javac(Java compiler ), a debugger, Java library source code, and many more tools. It is also a superset of JRE and JVM.&lt;/p&gt;

&lt;p&gt;Below is the complete JAVA 8 SE component diagram from oracle:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkey0cj5x1budmnlyrmbo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkey0cj5x1budmnlyrmbo.png" alt="Image description" width="777" height="524"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source - &lt;a href="https://docs.oracle.com/javase/8/docs/index.html" rel="noopener noreferrer"&gt;https://docs.oracle.com/javase/8/docs/index.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>beginners</category>
      <category>jdk</category>
      <category>jre</category>
    </item>
  </channel>
</rss>
