<?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: Dhairya Gemini</title>
    <description>The latest articles on DEV Community by Dhairya Gemini (@dhairya_gemini_246238182a).</description>
    <link>https://dev.to/dhairya_gemini_246238182a</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4057803%2F1d999db6-3a75-460d-b188-73899cfe8a37.jpg</url>
      <title>DEV Community: Dhairya Gemini</title>
      <link>https://dev.to/dhairya_gemini_246238182a</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dhairya_gemini_246238182a"/>
    <language>en</language>
    <item>
      <title>My Journey into Java Enterprise Development: From Java Fundamentals to Web Applications</title>
      <dc:creator>Dhairya Gemini</dc:creator>
      <pubDate>Sat, 03 Oct 2026 14:38:21 +0000</pubDate>
      <link>https://dev.to/dhairya_gemini_246238182a/my-journey-into-java-enterprise-development-from-java-fundamentals-to-web-applications-4o0m</link>
      <guid>https://dev.to/dhairya_gemini_246238182a/my-journey-into-java-enterprise-development-from-java-fundamentals-to-web-applications-4o0m</guid>
      <description>&lt;p&gt;Over the past few weeks, I’ve been taking a deeper dive into Java backend and enterprise development.&lt;/p&gt;

&lt;p&gt;Instead of only learning Java syntax and programming concepts, I wanted to understand what happens when Java is used to build real web applications—from handling HTTP requests to connecting applications with databases, managing dependencies, and writing automated tests.&lt;/p&gt;

&lt;p&gt;During this learning journey, I explored Eclipse, Java EE, Maven, Gradle, JDBC, Servlets, JSP, and JUnit.&lt;/p&gt;

&lt;p&gt;Here’s what I learned from each of them and how they connect together.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Eclipse — My Development Environment&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I started working with Eclipse IDE, which gave me a better understanding of how Java web projects are structured and managed.&lt;/p&gt;

&lt;p&gt;I worked with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java projects&lt;/li&gt;
&lt;li&gt;Web application projects&lt;/li&gt;
&lt;li&gt;Project configuration&lt;/li&gt;
&lt;li&gt;Debugging&lt;/li&gt;
&lt;li&gt;Server integration&lt;/li&gt;
&lt;li&gt;Managing source files and dependencies&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using an IDE isn't just about writing code faster. It also helps understand how a larger Java application is organized.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Java EE — Understanding Enterprise Java&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After working with core Java, I started exploring Java EE (Enterprise Edition) and the concepts behind Java-based web applications.&lt;/p&gt;

&lt;p&gt;This helped me understand how Java can be used beyond standalone programs to build applications that communicate with users, servers, databases, and other components.&lt;/p&gt;

&lt;p&gt;I started seeing Java not just as a programming language, but as part of a complete backend ecosystem.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Maven — Managing a Java Project&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One of the most useful things I learned was Maven.&lt;/p&gt;

&lt;p&gt;Before Maven, adding and managing libraries manually can become difficult as a project grows.&lt;/p&gt;

&lt;p&gt;Maven introduced me to concepts such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"pom.xml"&lt;/li&gt;
&lt;li&gt;Dependencies&lt;/li&gt;
&lt;li&gt;Plugins&lt;/li&gt;
&lt;li&gt;Project lifecycle&lt;/li&gt;
&lt;li&gt;Build management&lt;/li&gt;
&lt;li&gt;Dependency management&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It made me understand how professional Java projects manage external libraries and builds.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Gradle — Another Approach to Build Automation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After Maven, I explored Gradle.&lt;/p&gt;

&lt;p&gt;Gradle helped me understand another approach to build automation and dependency management.&lt;/p&gt;

&lt;p&gt;Comparing Maven and Gradle also taught me something important: there isn't always one tool for every situation. Understanding the concepts behind build systems is more valuable than simply memorizing commands.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;JDBC — Connecting Java with Databases&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then came JDBC (Java Database Connectivity).&lt;/p&gt;

&lt;p&gt;This was an important step because it connected my Java code with databases.&lt;/p&gt;

&lt;p&gt;I learned about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Database connections&lt;/li&gt;
&lt;li&gt;SQL queries&lt;/li&gt;
&lt;li&gt;"Connection"&lt;/li&gt;
&lt;li&gt;"PreparedStatement"&lt;/li&gt;
&lt;li&gt;"ResultSet"&lt;/li&gt;
&lt;li&gt;CRUD operations&lt;/li&gt;
&lt;li&gt;Exception handling&lt;/li&gt;
&lt;li&gt;Closing database resources&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;JDBC helped me understand what actually happens when a backend application communicates with a database.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Servlets — Understanding HTTP Requests&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Learning Servlets was one of the most interesting parts of this journey.&lt;/p&gt;

&lt;p&gt;Servlets helped me understand how a Java web application handles HTTP requests and responses.&lt;/p&gt;

&lt;p&gt;I learned about concepts such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"HttpServlet"&lt;/li&gt;
&lt;li&gt;"doGet()"&lt;/li&gt;
&lt;li&gt;"doPost()"&lt;/li&gt;
&lt;li&gt;"HttpServletRequest"&lt;/li&gt;
&lt;li&gt;"HttpServletResponse"&lt;/li&gt;
&lt;li&gt;Request parameters&lt;/li&gt;
&lt;li&gt;Response handling&lt;/li&gt;
&lt;li&gt;Servlet lifecycle&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This made the connection between the browser and backend much clearer to me.&lt;/p&gt;

&lt;p&gt;A request comes from the client → the server processes it → application logic runs → a response is returned.&lt;/p&gt;

&lt;p&gt;That simple flow helped me understand backend development much better.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;JSP — Dynamic Web Pages&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I also explored JSP (JavaServer Pages).&lt;/p&gt;

&lt;p&gt;JSP showed me how server-side Java applications can generate dynamic web content.&lt;/p&gt;

&lt;p&gt;While learning JSP, I started understanding how frontend pages can interact with backend logic and how server-side rendering works.&lt;/p&gt;

&lt;p&gt;It also helped me understand why separating presentation, business logic, and data access is important when building maintainable applications.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;JUnit — Testing My Code&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Finally, I learned JUnit for unit testing.&lt;/p&gt;

&lt;p&gt;This changed the way I think about writing code.&lt;/p&gt;

&lt;p&gt;Writing code that works once is one thing.&lt;/p&gt;

&lt;p&gt;Writing code that can be tested repeatedly and reliably is another.&lt;/p&gt;

&lt;p&gt;With JUnit, I explored:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Test cases&lt;/li&gt;
&lt;li&gt;Assertions&lt;/li&gt;
&lt;li&gt;Test methods&lt;/li&gt;
&lt;li&gt;Testing individual units of code&lt;/li&gt;
&lt;li&gt;Identifying failures automatically&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Testing helped me understand that development isn't only about creating features—it is also about making sure those features continue to work.&lt;/p&gt;

&lt;p&gt;How Everything Connects&lt;/p&gt;

&lt;p&gt;The most valuable part of this learning journey wasn't learning these technologies separately.&lt;/p&gt;

&lt;p&gt;It was understanding how they can work together.&lt;/p&gt;

&lt;p&gt;A simplified Java web application can look something like this:&lt;/p&gt;

&lt;p&gt;Client → Servlet → Business Logic → JDBC → Database&lt;/p&gt;

&lt;p&gt;And tools such as Maven or Gradle help manage the project and its dependencies, while JUnit helps test the application.&lt;/p&gt;

&lt;p&gt;Eclipse provides the development environment where I can build, debug, and manage the project.&lt;/p&gt;

&lt;p&gt;Understanding this bigger picture made the individual technologies much easier to understand.&lt;/p&gt;

&lt;p&gt;What I Learned Beyond the Technologies&lt;/p&gt;

&lt;p&gt;The biggest lesson wasn't a specific framework or command.&lt;/p&gt;

&lt;p&gt;It was learning how different components of backend development fit together.&lt;/p&gt;

&lt;p&gt;I learned that:&lt;/p&gt;

&lt;p&gt;«Learning backend development isn't just about learning a programming language. It's about understanding how applications communicate, store data, manage dependencies, handle requests, and verify that the code works.»&lt;/p&gt;

&lt;p&gt;I also became more comfortable reading documentation, debugging errors, understanding project structures, and figuring out why something isn't working instead of simply searching for a solution and copying it.&lt;/p&gt;

&lt;p&gt;What's Next?&lt;/p&gt;

&lt;p&gt;This is not the end of my Java learning journey.&lt;/p&gt;

&lt;p&gt;My next focus is to go deeper into backend development and start building more complete projects using the concepts I've learned.&lt;/p&gt;

&lt;p&gt;There is still a lot to learn—especially modern Java backend frameworks, REST APIs, security, database design, deployment, and scalable application architecture.&lt;/p&gt;

&lt;p&gt;But these technologies gave me a strong foundation for understanding what happens behind a Java web application.&lt;/p&gt;

&lt;p&gt;From Java fundamentals → Java web development → databases → testing → backend projects.&lt;/p&gt;

&lt;p&gt;One step at a time.&lt;/p&gt;

&lt;p&gt;Final Thoughts&lt;/p&gt;

&lt;p&gt;Learning Eclipse, Java EE, Maven, Gradle, JDBC, Servlets, JSP, and JUnit has been a valuable part of my journey as a Java developer.&lt;/p&gt;

&lt;p&gt;Each technology taught me something different, but together they helped me see the bigger picture of backend development.&lt;/p&gt;

&lt;p&gt;I'm still learning, still building, and still debugging.&lt;/p&gt;

&lt;p&gt;And honestly, that's one of the most interesting parts of software development.&lt;/p&gt;

&lt;p&gt;Build. Learn. Debug. Improve. Repeat.&lt;/p&gt;

</description>
      <category>java</category>
      <category>career</category>
      <category>backend</category>
      <category>development</category>
    </item>
    <item>
      <title>What Really Happens When You Run a Java Program? A Deep Dive from .java to JVM Execution ❓️❓️</title>
      <dc:creator>Dhairya Gemini</dc:creator>
      <pubDate>Sun, 09 Aug 2026 09:42:44 +0000</pubDate>
      <link>https://dev.to/dhairya_gemini_246238182a/what-really-happens-when-you-run-a-java-program-a-deep-dive-from-java-to-jvm-execution-3he2</link>
      <guid>https://dev.to/dhairya_gemini_246238182a/what-really-happens-when-you-run-a-java-program-a-deep-dive-from-java-to-jvm-execution-3he2</guid>
      <description>&lt;p&gt;What Really Happens When You Run a Java Program? A Deep Dive from ".java" to JVM Execution&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When we write a Java program, it looks deceptively simple:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;public class Main {&lt;br&gt;
    public static void main(String[] args) {&lt;br&gt;
        System.out.println("Hello, World!");&lt;br&gt;
    }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;We save the file, run:&lt;/p&gt;

&lt;p&gt;javac Main.java&lt;br&gt;
java Main&lt;/p&gt;

&lt;p&gt;and get:&lt;/p&gt;

&lt;p&gt;Hello, World!&lt;/p&gt;

&lt;p&gt;But what actually happens between these two commands?&lt;/p&gt;

&lt;p&gt;Java doesn't directly execute the ".java" file.&lt;/p&gt;

&lt;p&gt;Instead, the program goes through several stages involving the Java compiler, bytecode, class loader, JVM, interpreter, JIT compiler, and runtime memory.&lt;/p&gt;

&lt;p&gt;Let's break the entire process down.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Writing the Java Source Code&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;First, we write a Java source file:&lt;/p&gt;

&lt;p&gt;public class Main {&lt;br&gt;
    public static void main(String[] args) {&lt;br&gt;
        int a = 10;&lt;br&gt;
        int b = 20;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    System.out.println(a + b);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;The file is saved as:&lt;/p&gt;

&lt;p&gt;Main.java&lt;/p&gt;

&lt;p&gt;At this stage, it is simply human-readable source code.&lt;/p&gt;

&lt;p&gt;The computer cannot execute this source code directly.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;The Java Compiler Enters the Picture&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When we run:&lt;/p&gt;

&lt;p&gt;javac Main.java&lt;/p&gt;

&lt;p&gt;the Java compiler ("javac") analyzes our source code.&lt;/p&gt;

&lt;p&gt;It checks things such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Syntax&lt;/li&gt;
&lt;li&gt;Data types&lt;/li&gt;
&lt;li&gt;Variable declarations&lt;/li&gt;
&lt;li&gt;Method calls&lt;/li&gt;
&lt;li&gt;Class structure&lt;/li&gt;
&lt;li&gt;Access modifiers&lt;/li&gt;
&lt;li&gt;Other compile-time rules&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If everything is correct, the compiler generates:&lt;/p&gt;

&lt;p&gt;Main.class&lt;/p&gt;

&lt;p&gt;This is where Java becomes interesting.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Java Doesn't Compile Directly to Machine Code&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Languages such as C and C++ commonly compile source code into native machine code for a particular architecture.&lt;/p&gt;

&lt;p&gt;Java takes a different approach.&lt;/p&gt;

&lt;p&gt;The Java compiler converts:&lt;/p&gt;

&lt;p&gt;Java Source Code&lt;br&gt;
       ↓&lt;br&gt;
    javac&lt;br&gt;
       ↓&lt;br&gt;
    Bytecode&lt;br&gt;
       ↓&lt;br&gt;
   Main.class&lt;/p&gt;

&lt;p&gt;The ".class" file contains Java bytecode.&lt;/p&gt;

&lt;p&gt;For example, conceptually, our Java code might contain bytecode instructions such as:&lt;/p&gt;

&lt;p&gt;iload&lt;br&gt;
iadd&lt;br&gt;
invokevirtual&lt;br&gt;
return&lt;/p&gt;

&lt;p&gt;Bytecode is not native machine code.&lt;/p&gt;

&lt;p&gt;It is an intermediate instruction set designed to be executed by the Java Virtual Machine (JVM).&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Why Does Java Use Bytecode?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is one of the most important ideas behind Java's portability.&lt;/p&gt;

&lt;p&gt;Suppose you compile a Java program on Windows.&lt;/p&gt;

&lt;p&gt;The resulting ".class" file can potentially run on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows&lt;/li&gt;
&lt;li&gt;Linux&lt;/li&gt;
&lt;li&gt;macOS&lt;/li&gt;
&lt;li&gt;Other platforms with a compatible JVM&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The basic idea is:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;         Java Source
              ↓
           javac
              ↓
           Bytecode
              ↓
   ┌──────────┼──────────┐
   ↓          ↓          ↓
 JVM        JVM        JVM
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Windows     Linux      macOS&lt;/p&gt;

&lt;p&gt;The JVM handles the platform-specific execution.&lt;/p&gt;

&lt;p&gt;This is the foundation behind Java's famous:&lt;/p&gt;

&lt;p&gt;«Write Once, Run Anywhere»&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;The JVM Takes Over&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When we execute:&lt;/p&gt;

&lt;p&gt;java Main&lt;/p&gt;

&lt;p&gt;the JVM starts.&lt;/p&gt;

&lt;p&gt;But the JVM doesn't simply open the ".class" file and immediately execute everything.&lt;/p&gt;

&lt;p&gt;Several components become involved.&lt;/p&gt;

&lt;p&gt;A simplified pipeline looks like this:&lt;/p&gt;

&lt;p&gt;Main.class&lt;br&gt;
    ↓&lt;br&gt;
Class Loader&lt;br&gt;
    ↓&lt;br&gt;
Bytecode Verification&lt;br&gt;
    ↓&lt;br&gt;
Runtime Data Areas&lt;br&gt;
    ↓&lt;br&gt;
Execution Engine&lt;br&gt;
    ↓&lt;br&gt;
Interpreter / JIT Compiler&lt;br&gt;
    ↓&lt;br&gt;
Machine Code&lt;br&gt;
    ↓&lt;br&gt;
CPU&lt;/p&gt;

&lt;p&gt;Let's understand each part.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Class Loader&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Class Loader is responsible for loading class information into JVM memory.&lt;/p&gt;

&lt;p&gt;When the JVM needs the "Main" class, the Class Loader finds and loads it.&lt;/p&gt;

&lt;p&gt;Java's class-loading process is commonly discussed in three major phases:&lt;/p&gt;

&lt;p&gt;Loading&lt;/p&gt;

&lt;p&gt;The JVM finds the class and loads its binary representation.&lt;/p&gt;

&lt;p&gt;Linking&lt;/p&gt;

&lt;p&gt;Linking includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verification&lt;/li&gt;
&lt;li&gt;Preparation&lt;/li&gt;
&lt;li&gt;Resolution&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Initialization&lt;/p&gt;

&lt;p&gt;Static fields and static initialization blocks are initialized when required.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;class Example {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;static int number = 100;

static {
    System.out.println("Class initialized");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;The JVM performs class initialization according to Java's initialization rules.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Bytecode Verification&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Before executing bytecode, the JVM performs verification.&lt;/p&gt;

&lt;p&gt;The purpose is to ensure that the bytecode follows JVM constraints.&lt;/p&gt;

&lt;p&gt;This helps prevent invalid operations and contributes to Java's runtime safety model.&lt;/p&gt;

&lt;p&gt;Conceptually:&lt;/p&gt;

&lt;p&gt;.class file&lt;br&gt;
     ↓&lt;br&gt;
Bytecode Verifier&lt;br&gt;
     ↓&lt;br&gt;
Valid?&lt;br&gt;
  ↙     ↘&lt;br&gt;
Yes      No&lt;br&gt;
 ↓        ↓&lt;br&gt;
Execute   Error&lt;/p&gt;

&lt;p&gt;This is one reason Java's execution environment is more controlled than simply executing arbitrary machine instructions.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;JVM Runtime Memory&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The JVM manages several runtime data areas.&lt;/p&gt;

&lt;p&gt;Some of the most important ones are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Heap&lt;/li&gt;
&lt;li&gt;Java Virtual Machine Stacks&lt;/li&gt;
&lt;li&gt;Method Area&lt;/li&gt;
&lt;li&gt;PC Register&lt;/li&gt;
&lt;li&gt;Native Method Stacks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's focus on the most commonly discussed ones.&lt;/p&gt;




&lt;p&gt;Heap&lt;/p&gt;

&lt;p&gt;Objects are generally allocated on the heap.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;Student student = new Student();&lt;/p&gt;

&lt;p&gt;The object created by:&lt;/p&gt;

&lt;p&gt;new Student()&lt;/p&gt;

&lt;p&gt;is allocated in heap memory.&lt;/p&gt;

&lt;p&gt;The variable:&lt;/p&gt;

&lt;p&gt;student&lt;/p&gt;

&lt;p&gt;holds a reference to that object.&lt;/p&gt;

&lt;p&gt;Conceptually:&lt;/p&gt;

&lt;h2&gt;
  
  
  Stack
&lt;/h2&gt;

&lt;p&gt;student ──────────────┐&lt;br&gt;
                      ↓&lt;br&gt;
                    Heap&lt;br&gt;
                ┌───────────┐&lt;br&gt;
                │ Student   │&lt;br&gt;
                │ object    │&lt;br&gt;
                └───────────┘&lt;/p&gt;

&lt;p&gt;The JVM's garbage collector can later reclaim memory occupied by objects that are no longer reachable.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Stack Memory&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each thread has its own JVM stack.&lt;/p&gt;

&lt;p&gt;When a method is called, a new stack frame is created.&lt;/p&gt;

&lt;p&gt;Consider:&lt;/p&gt;

&lt;p&gt;public static void main(String[] args) {&lt;br&gt;
    calculate();&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;static void calculate() {&lt;br&gt;
    int x = 10;&lt;br&gt;
    int y = 20;&lt;br&gt;
    int result = x + y;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Conceptually:&lt;/p&gt;

&lt;p&gt;JVM Stack&lt;/p&gt;

&lt;p&gt;┌──────────────────┐&lt;br&gt;
│ calculate()      │&lt;br&gt;
│ x = 10           │&lt;br&gt;
│ y = 20           │&lt;br&gt;
│ result = 30      │&lt;br&gt;
├──────────────────┤&lt;br&gt;
│ main()           │&lt;br&gt;
│ args             │&lt;br&gt;
└──────────────────┘&lt;/p&gt;

&lt;p&gt;When "calculate()" finishes, its stack frame is removed.&lt;/p&gt;

&lt;p&gt;This is one reason method calls have a structured lifetime.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;The Execution Engine&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After the classes are loaded and verified, the JVM needs to execute the bytecode.&lt;/p&gt;

&lt;p&gt;This is handled by the Execution Engine.&lt;/p&gt;

&lt;p&gt;Two important mechanisms are:&lt;/p&gt;

&lt;p&gt;Interpreter&lt;/p&gt;

&lt;p&gt;The interpreter executes bytecode instructions.&lt;/p&gt;

&lt;p&gt;Conceptually:&lt;/p&gt;

&lt;p&gt;Bytecode&lt;br&gt;
   ↓&lt;br&gt;
Interpreter&lt;br&gt;
   ↓&lt;br&gt;
Instruction&lt;br&gt;
   ↓&lt;br&gt;
Instruction&lt;br&gt;
   ↓&lt;br&gt;
Instruction&lt;/p&gt;

&lt;p&gt;This allows code to start executing without compiling the entire application into native machine code first.&lt;/p&gt;

&lt;p&gt;But there is a performance problem.&lt;/p&gt;

&lt;p&gt;Interpreting the same instructions repeatedly can be expensive.&lt;/p&gt;

&lt;p&gt;That's where JIT enters.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;JIT Compilation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;JIT stands for:&lt;/p&gt;

&lt;p&gt;Just-In-Time compilation&lt;/p&gt;

&lt;p&gt;The JVM can identify frequently executed code and compile it into optimized native machine code.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;for (int i = 0; i &amp;lt; 1_000_000; i++) {&lt;br&gt;
    calculate();&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;If certain code becomes "hot", the JVM can optimize it.&lt;/p&gt;

&lt;p&gt;Conceptually:&lt;/p&gt;

&lt;p&gt;Bytecode&lt;br&gt;
   ↓&lt;br&gt;
Interpreter&lt;br&gt;
   ↓&lt;br&gt;
Frequently executed code&lt;br&gt;
   ↓&lt;br&gt;
JIT Compiler&lt;br&gt;
   ↓&lt;br&gt;
Native Machine Code&lt;br&gt;
   ↓&lt;br&gt;
CPU&lt;/p&gt;

&lt;p&gt;This is one of the major reasons modern Java applications can achieve strong runtime performance.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;What Is "Hot Code"?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The JVM doesn't necessarily treat every method equally.&lt;/p&gt;

&lt;p&gt;Some code executes once.&lt;/p&gt;

&lt;p&gt;Other code may execute millions of times.&lt;/p&gt;

&lt;p&gt;The JVM can monitor execution and identify frequently executed portions of the application.&lt;/p&gt;

&lt;p&gt;These are often referred to as hot spots.&lt;/p&gt;

&lt;p&gt;The JIT compiler can then apply optimizations to those frequently executed paths.&lt;/p&gt;

&lt;p&gt;Possible optimizations include techniques such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Method inlining&lt;/li&gt;
&lt;li&gt;Dead-code elimination&lt;/li&gt;
&lt;li&gt;Loop optimizations&lt;/li&gt;
&lt;li&gt;Escape analysis&lt;/li&gt;
&lt;li&gt;Other runtime-specific optimizations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The exact behavior depends on the JVM implementation and runtime conditions.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Where Do JDK and JRE Fit?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Many Java developers memorize:&lt;/p&gt;

&lt;p&gt;JDK&lt;br&gt;
JRE&lt;br&gt;
JVM&lt;/p&gt;

&lt;p&gt;but don't understand their relationship.&lt;/p&gt;

&lt;p&gt;A simplified model is:&lt;/p&gt;

&lt;p&gt;JDK&lt;br&gt;
└── Development Tools&lt;br&gt;
    ├── javac&lt;br&gt;
    ├── java&lt;br&gt;
    ├── javadoc&lt;br&gt;
    └── other tools&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+

Java Runtime Environment

    └── JVM
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Historically, the JRE was commonly distributed as a separate concept.&lt;/p&gt;

&lt;p&gt;Modern Java distributions don't necessarily provide a standalone JRE installation in the same way older Java versions did.&lt;/p&gt;

&lt;p&gt;The important conceptual distinction remains:&lt;/p&gt;

&lt;p&gt;JDK: development environment&lt;/p&gt;

&lt;p&gt;JVM: engine that executes Java bytecode&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Why Doesn't Java Just Compile Everything Before Running?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A natural question is:&lt;/p&gt;

&lt;p&gt;«If native machine code is faster, why doesn't Java simply compile everything before execution?»&lt;/p&gt;

&lt;p&gt;Because runtime information can be extremely valuable.&lt;/p&gt;

&lt;p&gt;The JVM can observe the actual behavior of the running application.&lt;/p&gt;

&lt;p&gt;For example, it may discover:&lt;/p&gt;

&lt;p&gt;Method A → rarely executed&lt;br&gt;
Method B → executed millions of times&lt;br&gt;
Method C → usually receives integers of a particular type&lt;/p&gt;

&lt;p&gt;The runtime can use this information to make optimization decisions.&lt;/p&gt;

&lt;p&gt;This is one of the powerful ideas behind modern managed runtimes.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;What Happens to "System.out.println()"?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Consider:&lt;/p&gt;

&lt;p&gt;System.out.println("Hello");&lt;/p&gt;

&lt;p&gt;This looks like one simple operation.&lt;/p&gt;

&lt;p&gt;But internally, several things happen:&lt;/p&gt;

&lt;p&gt;System&lt;br&gt;
  ↓&lt;br&gt;
out&lt;br&gt;
  ↓&lt;br&gt;
PrintStream&lt;br&gt;
  ↓&lt;br&gt;
println()&lt;br&gt;
  ↓&lt;br&gt;
Output mechanism&lt;br&gt;
  ↓&lt;br&gt;
Operating system&lt;br&gt;
  ↓&lt;br&gt;
Terminal&lt;/p&gt;

&lt;p&gt;The important lesson is that high-level Java statements often represent multiple layers of runtime behavior.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;The Complete Journey&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We can now visualize the entire process:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    Main.java
        │
        ▼
    Java Compiler
      javac
        │
        ▼
    Main.class
    Java Bytecode
        │
        ▼
   Class Loader
        │
        ▼
Bytecode Verification
        │
        ▼
 JVM Runtime Areas
        │
        ▼
  Execution Engine
     /        \
    /          \
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Interpreter        JIT&lt;br&gt;
        \          /&lt;br&gt;
         \        /&lt;br&gt;
          ▼      ▼&lt;br&gt;
        Native Machine Code&lt;br&gt;
                │&lt;br&gt;
                ▼&lt;br&gt;
               CPU&lt;/p&gt;

&lt;p&gt;This is the simplified mental model every Java developer should understand.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Why Understanding This Matters&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You might be thinking:&lt;/p&gt;

&lt;p&gt;«"Why should I care? Java already works."»&lt;/p&gt;

&lt;p&gt;Understanding the JVM becomes extremely useful when you start dealing with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Performance optimization&lt;/li&gt;
&lt;li&gt;Memory leaks&lt;/li&gt;
&lt;li&gt;Garbage collection&lt;/li&gt;
&lt;li&gt;Stack overflow&lt;/li&gt;
&lt;li&gt;"OutOfMemoryError"&lt;/li&gt;
&lt;li&gt;Multithreading&lt;/li&gt;
&lt;li&gt;Application profiling&lt;/li&gt;
&lt;li&gt;Backend development&lt;/li&gt;
&lt;li&gt;JVM tuning&lt;/li&gt;
&lt;li&gt;Production debugging&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, when you encounter:&lt;/p&gt;

&lt;p&gt;java.lang.StackOverflowError&lt;/p&gt;

&lt;p&gt;you should immediately think about stack frames and potentially excessive recursion.&lt;/p&gt;

&lt;p&gt;When you see:&lt;/p&gt;

&lt;p&gt;java.lang.OutOfMemoryError: Java heap space&lt;/p&gt;

&lt;p&gt;you should start thinking about heap allocation and object retention.&lt;/p&gt;

&lt;p&gt;Understanding the JVM turns these errors from mysterious messages into useful diagnostic signals.&lt;/p&gt;




&lt;p&gt;Final Thoughts&lt;/p&gt;

&lt;p&gt;Java is often described simply as:&lt;/p&gt;

&lt;p&gt;«"A programming language."»&lt;/p&gt;

&lt;p&gt;But Java is more than the syntax we write.&lt;/p&gt;

&lt;p&gt;A Java application involves an entire runtime ecosystem:&lt;/p&gt;

&lt;p&gt;Source Code&lt;br&gt;
     ↓&lt;br&gt;
Compiler&lt;br&gt;
     ↓&lt;br&gt;
Bytecode&lt;br&gt;
     ↓&lt;br&gt;
Class Loader&lt;br&gt;
     ↓&lt;br&gt;
JVM&lt;br&gt;
     ↓&lt;br&gt;
Runtime Memory&lt;br&gt;
     ↓&lt;br&gt;
Interpreter / JIT&lt;br&gt;
     ↓&lt;br&gt;
Native Code&lt;br&gt;
     ↓&lt;br&gt;
CPU&lt;/p&gt;

&lt;p&gt;Once you understand this pipeline, many advanced Java concepts become easier to reason about.&lt;/p&gt;

&lt;p&gt;The next time you run:&lt;/p&gt;

&lt;p&gt;java Main&lt;/p&gt;

&lt;p&gt;remember that you're not simply "running a Java file."&lt;/p&gt;

&lt;p&gt;You're starting a runtime system that loads bytecode, manages memory, interprets and compiles code, performs runtime optimizations, and ultimately turns Java instructions into work performed by your CPU.&lt;/p&gt;

&lt;p&gt;And that's where Java becomes much more interesting than just writing:&lt;/p&gt;

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




&lt;p&gt;What should you learn next?&lt;/p&gt;

&lt;p&gt;If you're going deeper into Java, a useful progression is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Java OOP&lt;/li&gt;
&lt;li&gt;Collections Framework&lt;/li&gt;
&lt;li&gt;Exception Handling&lt;/li&gt;
&lt;li&gt;Multithreading&lt;/li&gt;
&lt;li&gt;JVM Architecture&lt;/li&gt;
&lt;li&gt;Garbage Collection&lt;/li&gt;
&lt;li&gt;Java Memory Model&lt;/li&gt;
&lt;li&gt;JVM Performance Tuning&lt;/li&gt;
&lt;li&gt;Spring Boot&lt;/li&gt;
&lt;li&gt;Building production-grade backend systems&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Understanding the JVM is a strong foundation for that journey.&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>java</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>React Virtual DOM Explained: Why React Is So Fast</title>
      <dc:creator>Dhairya Gemini</dc:creator>
      <pubDate>Sat, 01 Aug 2026 10:02:19 +0000</pubDate>
      <link>https://dev.to/dhairya_gemini_246238182a/react-virtual-dom-explained-why-react-is-so-fast-175b</link>
      <guid>https://dev.to/dhairya_gemini_246238182a/react-virtual-dom-explained-why-react-is-so-fast-175b</guid>
      <description>

&lt;p&gt;Introduction&lt;/p&gt;

&lt;p&gt;When I first started learning React, one question kept coming to my mind:&lt;/p&gt;

&lt;p&gt;"Why is React considered faster than traditional JavaScript?"&lt;/p&gt;

&lt;p&gt;Many developers answer this by saying, "Because React uses the Virtual DOM."&lt;/p&gt;

&lt;p&gt;But what exactly is the Virtual DOM? Is it a real copy of the webpage? How does it improve performance?&lt;/p&gt;

&lt;p&gt;In this article, I'll explain the Virtual DOM in simple terms with examples so that even beginners can understand how React updates the user interface efficiently.&lt;/p&gt;




&lt;p&gt;What Is the DOM?&lt;/p&gt;

&lt;p&gt;DOM stands for Document Object Model.&lt;/p&gt;

&lt;p&gt;Whenever a browser loads an HTML page, it converts the HTML into a tree-like structure called the DOM.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;


&lt;h1&gt;Hello&lt;/h1&gt;
&lt;br&gt;
  Click Me&lt;br&gt;


&lt;p&gt;becomes&lt;/p&gt;

&lt;p&gt;Body&lt;br&gt;
 ├── H1&lt;br&gt;
 └── Button&lt;/p&gt;

&lt;p&gt;JavaScript interacts with this DOM to update the webpage.&lt;/p&gt;




&lt;p&gt;The Problem with the Traditional DOM&lt;/p&gt;

&lt;p&gt;Imagine a webpage containing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hundreds of buttons&lt;/li&gt;
&lt;li&gt;Thousands of list items&lt;/li&gt;
&lt;li&gt;Complex tables&lt;/li&gt;
&lt;li&gt;Images&lt;/li&gt;
&lt;li&gt;Charts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If only one small piece of data changes, the browser still has to perform expensive operations to update the DOM.&lt;/p&gt;

&lt;p&gt;Frequent DOM updates can slow down an application because manipulating the real DOM is costly.&lt;/p&gt;




&lt;p&gt;What Is the Virtual DOM?&lt;/p&gt;

&lt;p&gt;The Virtual DOM is a lightweight JavaScript representation of the real DOM.&lt;/p&gt;

&lt;p&gt;Instead of immediately changing the real webpage, React first creates a virtual copy in memory.&lt;/p&gt;

&lt;p&gt;When data changes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;React creates a new Virtual DOM.&lt;/li&gt;
&lt;li&gt;It compares it with the previous Virtual DOM.&lt;/li&gt;
&lt;li&gt;It finds exactly what changed.&lt;/li&gt;
&lt;li&gt;It updates only those specific parts of the real DOM.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This makes updates much more efficient.&lt;/p&gt;




&lt;p&gt;A Simple Example&lt;/p&gt;

&lt;p&gt;Suppose you have:&lt;/p&gt;

&lt;h1&gt;Counter: 0&lt;/h1&gt;

&lt;p&gt;After clicking a button:&lt;/p&gt;

&lt;h1&gt;Counter: 1&lt;/h1&gt;

&lt;p&gt;React notices that only the number changed.&lt;/p&gt;

&lt;p&gt;Instead of rebuilding the entire page, it updates only the text node.&lt;/p&gt;

&lt;p&gt;This saves time and improves performance.&lt;/p&gt;




&lt;p&gt;How React Finds Changes&lt;/p&gt;

&lt;p&gt;React uses a process called Diffing.&lt;/p&gt;

&lt;p&gt;It compares:&lt;/p&gt;

&lt;p&gt;Old Virtual DOM&lt;/p&gt;

&lt;p&gt;↓&lt;/p&gt;

&lt;p&gt;New Virtual DOM&lt;/p&gt;

&lt;p&gt;↓&lt;/p&gt;

&lt;p&gt;Find the differences&lt;/p&gt;

&lt;p&gt;↓&lt;/p&gt;

&lt;p&gt;Update only the changed elements.&lt;/p&gt;

&lt;p&gt;This process is extremely fast.&lt;/p&gt;




&lt;p&gt;Reconciliation&lt;/p&gt;

&lt;p&gt;The complete process of comparing Virtual DOMs and updating the real DOM is called Reconciliation.&lt;/p&gt;

&lt;p&gt;React automatically performs reconciliation whenever state or props change.&lt;/p&gt;

&lt;p&gt;Developers don't need to manually update the DOM.&lt;/p&gt;




&lt;p&gt;Why Is React Fast?&lt;/p&gt;

&lt;p&gt;React is efficient because it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reduces unnecessary DOM updates.&lt;/li&gt;
&lt;li&gt;Updates only changed elements.&lt;/li&gt;
&lt;li&gt;Keeps the UI synchronized with data.&lt;/li&gt;
&lt;li&gt;Improves the user experience.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's important to remember that React is not always faster than every approach. Its main advantage is reducing unnecessary work and making UI updates predictable.&lt;/p&gt;




&lt;p&gt;Real-World Analogy&lt;/p&gt;

&lt;p&gt;Imagine a teacher checking a 500-page book.&lt;/p&gt;

&lt;p&gt;Option 1:&lt;br&gt;
Read every page again.&lt;/p&gt;

&lt;p&gt;Option 2:&lt;br&gt;
Read only the pages that changed.&lt;/p&gt;

&lt;p&gt;Which is faster?&lt;/p&gt;

&lt;p&gt;The second option.&lt;/p&gt;

&lt;p&gt;That's exactly how the Virtual DOM works.&lt;/p&gt;




&lt;p&gt;Example&lt;/p&gt;

&lt;p&gt;function Counter() {&lt;br&gt;
  const [count, setCount] = React.useState(0);&lt;/p&gt;

&lt;p&gt;return (&lt;br&gt;
    &amp;lt;&amp;gt;&lt;br&gt;
      &lt;/p&gt;
&lt;h1&gt;{count}&lt;/h1&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  &amp;lt;button onClick={() =&amp;gt; setCount(count + 1)}&amp;gt;
    Increment
  &amp;lt;/button&amp;gt;
&amp;lt;/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;);&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;When the button is clicked, React updates only the "&lt;/p&gt;
&lt;h1&gt;" value instead of rebuilding the entire page.&lt;/h1&gt;





&lt;p&gt;Common Misconceptions&lt;/p&gt;

&lt;p&gt;❌ Virtual DOM is the real webpage.&lt;/p&gt;

&lt;p&gt;✔️ No. It is only a JavaScript representation.&lt;/p&gt;

&lt;p&gt;❌ React reloads the entire page.&lt;/p&gt;

&lt;p&gt;✔️ No. React updates only the necessary elements.&lt;/p&gt;

&lt;p&gt;❌ Virtual DOM makes everything instantly fast.&lt;/p&gt;

&lt;p&gt;✔️ Performance also depends on component design, rendering strategy, and application structure.&lt;/p&gt;




&lt;p&gt;Interview Questions&lt;/p&gt;

&lt;p&gt;Q1. What is the Virtual DOM?&lt;/p&gt;

&lt;p&gt;A lightweight JavaScript representation of the real DOM that React uses to determine efficient UI updates.&lt;/p&gt;

&lt;p&gt;Q2. What is Diffing?&lt;/p&gt;

&lt;p&gt;The process of comparing the previous and new Virtual DOM trees to identify changes.&lt;/p&gt;

&lt;p&gt;Q3. What is Reconciliation?&lt;/p&gt;

&lt;p&gt;React's process of applying the detected changes to the real DOM efficiently.&lt;/p&gt;

&lt;p&gt;Q4. Why is manipulating the real DOM expensive?&lt;/p&gt;

&lt;p&gt;Because browser rendering and layout calculations take more resources than working with lightweight JavaScript objects.&lt;/p&gt;




&lt;p&gt;Key Takeaways&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DOM stands for Document Object Model.&lt;/li&gt;
&lt;li&gt;React uses a Virtual DOM instead of directly updating the real DOM.&lt;/li&gt;
&lt;li&gt;React compares the old and new Virtual DOM using Diffing.&lt;/li&gt;
&lt;li&gt;Reconciliation updates only the necessary parts of the real DOM.&lt;/li&gt;
&lt;li&gt;This approach improves performance and provides a smoother user experience.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Final Thoughts&lt;/p&gt;

&lt;p&gt;Understanding the Virtual DOM is one of the first major steps toward understanding how React works internally.&lt;/p&gt;

&lt;p&gt;Instead of memorizing that "React is fast," try to understand why React is efficient. Once you grasp concepts like the Virtual DOM, Diffing, and Reconciliation, many other React features become much easier to learn.&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;



</description>
      <category>frontend</category>
      <category>javascript</category>
      <category>performance</category>
      <category>react</category>
    </item>
  </channel>
</rss>
