<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[ByteCraft]]></title><description><![CDATA[From Java Fundamentals to Scalable Systems, One Concept at a Time.]]></description><link>https://gauravrshegekar.substack.com</link><image><url>https://substackcdn.com/image/fetch/$s_!3-Qn!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36cd260c-aea9-4d05-80ec-3e81d70c6fcd_1254x1254.png</url><title>ByteCraft</title><link>https://gauravrshegekar.substack.com</link></image><generator>Substack</generator><lastBuildDate>Sat, 20 Jun 2026 14:31:34 GMT</lastBuildDate><atom:link href="https://gauravrshegekar.substack.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Gaurav Shegekar]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[gauravrshegekar@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[gauravrshegekar@substack.com]]></itunes:email><itunes:name><![CDATA[Gaurav Shegekar]]></itunes:name></itunes:owner><itunes:author><![CDATA[Gaurav Shegekar]]></itunes:author><googleplay:owner><![CDATA[gauravrshegekar@substack.com]]></googleplay:owner><googleplay:email><![CDATA[gauravrshegekar@substack.com]]></googleplay:email><googleplay:author><![CDATA[Gaurav Shegekar]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Primitive vs Non-Primitive Data Types in Java]]></title><description><![CDATA[Understanding How Data is Stored]]></description><link>https://gauravrshegekar.substack.com/p/primitive-vs-non-primitive-data-types</link><guid isPermaLink="false">https://gauravrshegekar.substack.com/p/primitive-vs-non-primitive-data-types</guid><dc:creator><![CDATA[Gaurav Shegekar]]></dc:creator><pubDate>Sat, 20 Jun 2026 14:30:42 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/7f7c7fc6-b9ae-4cff-b7ee-8c5ee359b468_1731x909.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Every application stores data.</p><p>For example, an e-commerce application may store:</p><ul><li><p>Product Name</p></li><li><p>Product Price</p></li><li><p>Product Quantity</p></li><li><p>Customer Details</p></li></ul><p>But not all data is stored in the same way.</p><p>Java divides data types into two categories:</p><ol><li><p>Primitive Data Types</p></li><li><p>Non-Primitive Data Types</p></li></ol><p>Understanding the difference is important because it affects:</p><ul><li><p>Memory usage</p></li><li><p>Performance</p></li><li><p>Null handling</p></li><li><p>Object behavior</p></li></ul><p>Let&#8217;s explore both in a practical way.</p><div><hr></div><h2>What is a Data Type?</h2><p>A data type tells Java:</p><ul><li><p>What kind of value will be stored</p></li><li><p>How much memory should be allocated</p></li><li><p>What operations can be performed</p></li></ul><p>Example:</p><pre><code><code>int age = 24;
</code></code></pre><p>Here:</p><pre><code><code>int
</code></code></pre><p>tells Java that the variable will store an integer value.</p><div><hr></div><h2>Primitive Data Types</h2><p>Primitive data types are predefined by Java.</p><p>They store the actual value directly in memory.</p><p>Java provides 8 primitive data types.</p><p>Data Type</p><p><code>byte | short | int | long | float | double | char | boolean </code></p><p>Example:</p><pre><code><code>int quantity = 5;
double price = 499.99;
boolean isAvailable = true;
</code></code></pre><p>In all these cases, the actual value is stored directly.</p><div><hr></div><h2>Characteristics of Primitive Types</h2><h3>Fixed Memory Size</h3><p>Each primitive type has a predefined memory size.</p><p>Example:</p><pre><code><code>int &#8594; 4 bytes
double &#8594; 8 bytes
boolean &#8594; JVM dependent
</code></code></pre><div><hr></div><h3>Faster Access</h3><p>Since the value is stored directly, primitive types are generally faster.</p><p>Example:</p><pre><code><code>int count = 100;
</code></code></pre><p>Java can access this value immediately.</p><div><hr></div><h3>Cannot Store Null</h3><p>Primitive variables must always contain a valid value.</p><pre><code><code>int age = null;
</code></code></pre><p>This causes a compilation error.</p><div><hr></div><h2>Non-Primitive Data Types</h2><p>Non-Primitive Data Types are objects.</p><p>Instead of storing the actual value directly, they store a reference to an object.</p><p>Examples:</p><ul><li><p>String</p></li><li><p>Array</p></li><li><p>Class Objects</p></li><li><p>Interfaces</p></li><li><p>Collections</p></li></ul><p>Example:</p><pre><code><code>String customerName = "Gaurav";
</code></code></pre><p>Here, the variable does not directly store the entire String object.</p><p>Instead, it stores a reference to where the object exists in memory.</p><div><hr></div><h2>Real-World Analogy</h2><p>Imagine a warehouse.</p><h3>Primitive Type</h3><p>You keep the item in your hand.</p><pre><code><code>Value &#8594; Direct Access
</code></code></pre><div><hr></div><h3>Non-Primitive Type</h3><p>You keep a warehouse address.</p><pre><code><code>Reference &#8594; Object Location
</code></code></pre><p>You use the address whenever you need the item.</p><p>This is how object references work in Java.</p><div><hr></div><h2>Primitive Example</h2><pre><code><code>int quantity = 10;
</code></code></pre><p>Conceptually:</p><pre><code><code>quantity
   |
   v
  10
</code></code></pre><p>The value is stored directly.</p><div><hr></div><h2>Non-Primitive Example</h2><pre><code><code>String name = "Gaurav";
</code></code></pre><p>Conceptually:</p><pre><code><code>name
  |
  v
String Object
   |
   v
"Gaurav"
</code></code></pre><p>The variable stores a reference to the object.</p><div><hr></div><h2>Can Non-Primitive Types Store Null?</h2><p>Yes.</p><p>Example:</p><pre><code><code>String customerName = null;
</code></code></pre><p>This means:</p><pre><code><code>No object reference assigned
</code></code></pre><p>This is valid.</p><div><hr></div><h2>Common Interview Question</h2><h3>Why is String a Non-Primitive Data Type?</h3><p>Because String is a class.</p><p>Example:</p><pre><code><code>String name = "Java";
</code></code></pre><p>Internally:</p><pre><code><code>String name = new String("Java");
</code></code></pre><p>Strings are objects, not primitive values.</p><div><hr></div><div><hr></div><h2>Real-World Example</h2><p>Consider an Order object.</p><pre><code><code>int quantity = 2;
double price = 499.99;
String productName = "Wireless Mouse";
</code></code></pre><p>Here:</p><p>Primitive Types:</p><pre><code><code>int quantity
double price
</code></code></pre><p>Non-Primitive Type:</p><pre><code><code>String productName
</code></code></pre><p>Java uses both categories because each serves a different purpose.</p><div><hr></div><h2>Interview Questions</h2><h3>1. How many primitive data types are available in Java?</h3><p>Java provides 8 primitive data types.</p><div><hr></div><h3>2. What is the main difference between primitive and non-primitive types?</h3><p>Primitive types store actual values.</p><p>Non-primitive types store references to objects.</p><div><hr></div><h3>3. Can primitive types store null?</h3><p>No.</p><p>Primitive types must always contain a valid value.</p><div><hr></div><h3>4. Is String a primitive data type?</h3><p>No.</p><p>String is a class and therefore a non-primitive data type.</p><div><hr></div><h3>5. Which is generally faster?</h3><p>Primitive data types because the value is stored directly.</p><div><hr></div><h2>Key Takeaways</h2><p>&#9989; Java has Primitive and Non-Primitive Data Types.</p><p>&#9989; Primitive types store actual values.</p><p>&#9989; Non-Primitive types store object references.</p><p>&#9989; Primitive types are generally faster and consume less memory.</p><p>&#9989; Non-Primitive types can store null values.</p><p>&#9989; String is a non-primitive data type because it is an object.</p><p>In the next blog, we&#8217;ll explore:</p><p><strong>Java Operators: How Programs Perform Calculations and Comparisons</strong></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://gauravrshegekar.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading ByteCraft! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[Variables in Java]]></title><description><![CDATA[How Java Stores and Manages Data]]></description><link>https://gauravrshegekar.substack.com/p/variables-in-java</link><guid isPermaLink="false">https://gauravrshegekar.substack.com/p/variables-in-java</guid><dc:creator><![CDATA[Gaurav Shegekar]]></dc:creator><pubDate>Sat, 20 Jun 2026 02:24:46 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/5b2c7825-4f19-464a-b923-8be0d48a403f_1728x910.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Imagine building an e-commerce application.</p><p>You need to store:</p><ul><li><p>Customer names</p></li><li><p>Product prices</p></li><li><p>Order quantities</p></li><li><p>Payment status</p></li></ul><p>Without a way to store data, a program would be unable to perform even the simplest operations.</p><p>This is where <strong>variables</strong> come in.</p><p>Variables are one of the most fundamental concepts in programming. They act as containers that store data which can be used and modified throughout a program.</p><p>In this article, we&#8217;ll understand what variables are, why they are important, and how Java stores data using variables.</p><div><hr></div><h2>What is a Variable?</h2><p>A variable is a named memory location used to store data.</p><p>Think of it like a labeled box.</p><pre><code><code>Customer Name Box &#8594; Gaurav
Age Box &#8594; 24
Price Box &#8594; 499
</code></code></pre><p>Instead of remembering memory addresses, developers use meaningful names.</p><p>Example:</p><pre><code><code>String customerName = "Gaurav";
int age = 24;
double price = 499.99;
</code></code></pre><p>Here:</p><ul><li><p><code>customerName</code></p></li><li><p><code>age</code></p></li><li><p><code>price</code></p></li></ul><p>are variables.</p><div><hr></div><h2>Why Do We Need Variables?</h2><p>Consider this program:</p><pre><code><code>System.out.println("Gaurav");
System.out.println("Gaurav");
System.out.println("Gaurav");
</code></code></pre><p>If the name changes, you&#8217;ll need to update it everywhere.</p><p>Using variables:</p><pre><code><code>String customerName = "Gaurav";

System.out.println(customerName);
System.out.println(customerName);
System.out.println(customerName);
</code></code></pre><p>Now the value only needs to be changed in one place.</p><p>This improves:</p><ul><li><p>Readability</p></li><li><p>Maintainability</p></li><li><p>Reusability</p></li></ul><div><hr></div><h2>Declaring a Variable</h2><p>The general syntax is:</p><pre><code><code>dataType variableName = value;
</code></code></pre><p>Example:</p><pre><code><code>int age = 24;
</code></code></pre><p>Here:</p><ul><li><p><code>int</code> &#8594; Data Type</p></li><li><p><code>age</code> &#8594; Variable Name</p></li><li><p><code>24</code> &#8594; Value</p></li></ul><div><hr></div><h2>Common Variable Types</h2><h3>Integer</h3><p>Stores whole numbers.</p><pre><code><code>int quantity = 10;
</code></code></pre><div><hr></div><h3>Double</h3><p>Stores decimal numbers.</p><pre><code><code>double price = 499.99;
</code></code></pre><div><hr></div><h3>Character</h3><p>Stores a single character.</p><pre><code><code>char grade = 'A';
</code></code></pre><div><hr></div><h3>Boolean</h3><p>Stores true or false.</p><pre><code><code>boolean isPaid = true;
</code></code></pre><div><hr></div><h3>String</h3><p>Stores text.</p><pre><code><code>String customerName = "Gaurav";
</code></code></pre><div><hr></div><h2>Real-World Example</h2><p>Imagine an online shopping application.</p><pre><code><code>String productName = "Wireless Mouse";
double price = 799.99;
int quantity = 2;
boolean inStock = true;
</code></code></pre><p>These variables help the application keep track of product information.</p><p>Without variables, dynamic applications would be impossible.</p><div><hr></div><h2>Variable Naming Best Practices</h2><p>Good variable names:</p><pre><code><code>customerName
productPrice
orderCount
</code></code></pre><p>Bad variable names:</p><pre><code><code>a
b
x1
temp123
</code></code></pre><p>A good variable name should clearly describe the data it stores.</p><div><hr></div><h2>What Happens Internally?</h2><p>When Java executes:</p><pre><code><code>int age = 24;
</code></code></pre><p>Memory is allocated for storing the value.</p><p>Conceptually:</p><pre><code><code>Variable Name     Value
-----------------------
age               24
</code></code></pre><p>The variable name points to a location where the value is stored.</p><p>This is one of the reasons variables are called containers for data.</p><div><hr></div><h2>Common Beginner Mistakes</h2><h3>Using an Uninitialized Variable</h3><pre><code><code>int age;
System.out.println(age);
</code></code></pre><p>This causes a compilation error because Java requires local variables to be initialized before use.</p><div><hr></div><h3>Wrong Data Type</h3><pre><code><code>int price = 99.99;
</code></code></pre><p>Error:</p><pre><code><code>Possible lossy conversion from double to int
</code></code></pre><p>Correct:</p><pre><code><code>double price = 99.99;
</code></code></pre><div><hr></div><h2>Interview Questions</h2><h3>1. What is a Variable in Java?</h3><p>A variable is a named memory location used to store data.</p><div><hr></div><h3>2. Why Do We Use Variables?</h3><p>Variables allow programs to store, retrieve, and manipulate data efficiently.</p><div><hr></div><h3>3. What is the Syntax for Declaring a Variable?</h3><pre><code><code>dataType variableName = value;
</code></code></pre><p>Example:</p><pre><code><code>int age = 24;
</code></code></pre><div><hr></div><h3>4. Can a Variable Change Its Value?</h3><p>Yes.</p><pre><code><code>int age = 24;
age = 25;
</code></code></pre><p>Variables can store new values during program execution.</p><div><hr></div><h2>Key Takeaways</h2><p>&#9989; Variables store data used by a program.</p><p>&#9989; Every variable has a data type, name, and value.</p><p>&#9989; Meaningful variable names improve code readability.</p><p>&#9989; Variables make applications dynamic and maintainable.</p><p>&#9989; Choosing the correct data type is important for efficient memory usage.</p><p>In the next blog, we&#8217;ll explore:</p><p><strong>Primitive vs Non-Primitive Data Types in Java: Understanding How Data is Stored.</strong></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://gauravrshegekar.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading ByteCraft! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[Java Compilation Process & Bytecode]]></title><description><![CDATA[What Really Happens When You Run a Java Program?]]></description><link>https://gauravrshegekar.substack.com/p/java-compilation-process-and-bytecode</link><guid isPermaLink="false">https://gauravrshegekar.substack.com/p/java-compilation-process-and-bytecode</guid><dc:creator><![CDATA[Gaurav Shegekar]]></dc:creator><pubDate>Fri, 19 Jun 2026 15:31:01 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/b0e34084-51e1-4608-a80d-31e9b9ab1acc_1728x910.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Every Java developer has written a program like this:</p><pre><code><code>public class Main {
    public static void main(String[] args) {
        System.out.println("Hello Java");
    }
}
</code></code></pre><p>We click <strong>Run</strong> and immediately see the output.</p><p>But have you ever wondered what happens behind the scenes?</p><p>How does a simple <code>.java</code> file eventually become machine instructions that your computer can execute?</p><p>Understanding the Java Compilation Process is essential because it explains one of Java&#8217;s biggest advantages: <strong>Platform Independence</strong>.</p><div><hr></div><h2>The Journey of a Java Program</h2><p>When you execute a Java application, it doesn&#8217;t run directly.</p><p>Instead, it goes through multiple stages.</p><pre><code><code>Source Code (.java)
        &#8595;
Java Compiler (javac)
        &#8595;
Bytecode (.class)
        &#8595;
JVM
        &#8595;
Machine Code
        &#8595;
Output</code></code></pre><p>Let&#8217;s understand each step.</p><div><hr></div><h2>Step 1: Writing Java Source Code</h2><p>The journey starts with a source file.</p><p>Example:</p><pre><code><code>public class Main {
    public static void main(String[] args) {
        System.out.println("Hello Java");
    }
}
</code></code></pre><p>This file is saved as:</p><pre><code><code>Main.java
</code></code></pre><p>At this stage, the code is human-readable.</p><p>Your computer cannot understand it directly.</p><div><hr></div><h2>Step 2: Compilation Using javac</h2><p>Java provides a compiler called:</p><pre><code><code>javac
</code></code></pre><p>When we execute:</p><pre><code><code>javac Main.java
</code></code></pre><p>The compiler checks:</p><ul><li><p>Syntax errors</p></li><li><p>Type errors</p></li><li><p>Invalid declarations</p></li></ul><p>If everything is correct, it generates:</p><pre><code><code>Main.class
</code></code></pre><p>This file contains <strong>Bytecode</strong>.</p><div><hr></div><h2>Step 3: What is Bytecode?</h2><p>Bytecode is an intermediate language generated by the Java compiler.</p><p>It is not:</p><p>&#10060; Human-readable</p><p>&#10060; Operating-system specific</p><p>&#10060; Processor specific</p><p>Instead, it is designed specifically for the JVM.</p><p>Think of Bytecode as a universal language that every JVM can understand.</p><div><hr></div><h2>Why Doesn&#8217;t Java Generate Machine Code Directly?</h2><p>Languages like C and C++ generate machine code directly.</p><p>Example:</p><pre><code><code>C Source Code
      &#8595;
Compiler
      &#8595;
Machine Code
</code></code></pre><p>The problem is that machine code is platform-specific.</p><p>A Windows executable may not work on Linux.</p><p>Java solves this problem by introducing Bytecode.</p><pre><code><code>Java Source Code
       &#8595;
Compiler
       &#8595;
Bytecode
       &#8595;
JVM
       &#8595;
Machine Code
</code></code></pre><p>This extra layer makes Java platform independent.</p><div><hr></div><h2>Step 4: JVM Loads the Bytecode</h2><p>When you run:</p><pre><code><code>java Main
</code></code></pre><p>The JVM starts.</p><p>Its first responsibility is to load the generated <code>.class</code> file.</p><p>This task is handled by the:</p><h3>Class Loader</h3><p>The Class Loader:</p><ul><li><p>Finds class files</p></li><li><p>Loads them into memory</p></li><li><p>Makes them available for execution</p></li></ul><div><hr></div><h2>Step 5: Bytecode Verification</h2><p>Before execution, the JVM verifies the bytecode.</p><p>It checks:</p><ul><li><p>Security rules</p></li><li><p>Memory access rules</p></li><li><p>Illegal instructions</p></li></ul><p>This helps make Java secure and reliable.</p><div><hr></div><h2>Step 6: Execution by JVM</h2><p>After verification, the JVM executes the bytecode.</p><p>Modern JVMs use:</p><h3>JIT Compiler (Just-In-Time Compiler)</h3><p>Instead of interpreting every instruction repeatedly, the JIT compiler:</p><ul><li><p>Identifies frequently used code</p></li><li><p>Converts it into native machine code</p></li><li><p>Stores optimized versions</p></li></ul><p>This significantly improves performance.</p><div><hr></div><h2>Complete Execution Flow</h2><pre><code><code>Main.java
    |
    v
javac Compiler
    |
    v
Main.class
(Bytecode)
    |
    v
Class Loader
    |
    v
Bytecode Verifier
    |
    v
JVM Execution Engine
    |
    v
JIT Compiler
    |
    v
Machine Code
    |
    v
Output</code></code></pre><div><hr></div><h2>Real-World Example</h2><p>Imagine you&#8217;re developing a Spring Boot application on Windows.</p><p>The compiler generates Bytecode.</p><p>That same Bytecode can be deployed to:</p><ul><li><p>Linux Server</p></li><li><p>Ubuntu Cloud Instance</p></li><li><p>macOS Machine</p></li></ul><p>The JVM on each platform translates the Bytecode into platform-specific machine instructions.</p><p>This is the reason Java follows:</p><p><strong>Write Once, Run Anywhere.</strong></p><div><hr></div><h2>Interview Questions</h2><h3>1. What is the Java Compilation Process?</h3><p>Java source code is compiled into Bytecode using the <code>javac</code> compiler. The JVM then loads, verifies, and executes the Bytecode.</p><div><hr></div><h3>2. What is Bytecode?</h3><p>Bytecode is an intermediate representation of Java code generated by the Java compiler.</p><div><hr></div><h3>3. Which file contains Bytecode?</h3><p>The <code>.class</code> file contains Bytecode.</p><p>Example:</p><pre><code><code>Main.class
</code></code></pre><div><hr></div><h3>4. Why does Java use Bytecode?</h3><p>Bytecode enables platform independence because it can run on any JVM regardless of the operating system.</p><div><hr></div><h3>5. What is JIT Compiler?</h3><p>The JIT Compiler converts frequently executed Bytecode into optimized machine code at runtime to improve performance.</p><div><hr></div><h2>Key Takeaways</h2><p>&#9989; Java source code is stored in <code>.java</code> files.</p><p>&#9989; The <code>javac</code> compiler converts source code into Bytecode.</p><p>&#9989; Bytecode is stored inside <code>.class</code> files.</p><p>&#9989; JVM loads and verifies Bytecode.</p><p>&#9989; JIT Compiler converts Bytecode into optimized machine code.</p><p>&#9989; Bytecode is the reason Java is platform independent.</p><p>In the next blog, we&#8217;ll dive deeper into one of the JVM&#8217;s most important components:</p><p><strong>Understanding the JVM Architecture: Class Loader, Memory Areas, and Execution Engine.</strong></p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://gauravrshegekar.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading ByteCraft! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[JDK vs JRE vs JVM]]></title><description><![CDATA[Understanding the Difference Every Java Developer Should Know]]></description><link>https://gauravrshegekar.substack.com/p/jdk-vs-jre-vs-jvm</link><guid isPermaLink="false">https://gauravrshegekar.substack.com/p/jdk-vs-jre-vs-jvm</guid><dc:creator><![CDATA[Gaurav Shegekar]]></dc:creator><pubDate>Fri, 19 Jun 2026 01:08:20 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/3c60677b-f6dd-4460-89d8-742f01eb095d_1731x909.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If you&#8217;ve started learning Java, you&#8217;ve probably heard these three terms:</p><ul><li><p>JVM</p></li><li><p>JRE</p></li><li><p>JDK</p></li></ul><p>At first, they seem confusing because they are closely related.</p><p>One of the most common Java interview questions is:</p><p><strong>&#8220;Can you explain the difference between JDK, JRE, and JVM?&#8221;</strong></p><p>Let&#8217;s understand them in the simplest way possible.</p><div><hr></div><h2>The Big Picture</h2><p>Think of Java development like driving a car.</p><p>To build a car, drive a car, and run a transportation system, different components are needed.</p><p>Similarly, Java applications require different components during development and execution.</p><p>Those components are:</p><pre><code><code>JDK
 &#9492;&#9472;&#9472; JRE
      &#9492;&#9472;&#9472; JVM</code></code></pre><p>The JDK contains the JRE.</p><p>The JRE contains the JVM.</p><div><hr></div><h2>What is JVM?</h2><p>JVM stands for:</p><p><strong>Java Virtual Machine</strong></p><p>It is the engine responsible for running Java bytecode.</p><p>When you compile a Java program:</p><pre><code><code>public class Main {
    public static void main(String[] args) {
        System.out.println("Hello Java");
    }
}
</code></code></pre><p>Java creates:</p><pre><code><code>Main.class
</code></code></pre><p>This <code>.class</code> file contains bytecode.</p><p>The JVM reads that bytecode and converts it into machine instructions that your operating system understands.</p><h3>Responsibilities of JVM</h3><ul><li><p>Executes Java bytecode</p></li><li><p>Loads classes into memory</p></li><li><p>Manages memory</p></li><li><p>Performs garbage collection</p></li><li><p>Provides platform independence</p></li></ul><p>Without the JVM, Java applications cannot run.</p><div><hr></div><h2>What is JRE?</h2><p>JRE stands for:</p><p><strong>Java Runtime Environment</strong></p><p>Its purpose is to provide everything required to run Java applications.</p><p>Think of it as:</p><pre><code><code>JRE = JVM + Java Libraries
</code></code></pre><p>The JRE contains:</p><ul><li><p>JVM</p></li><li><p>Core Java Libraries</p></li><li><p>Runtime Components</p></li></ul><p>If you only want to run a Java application and do not need to write Java code, the JRE is sufficient.</p><h3>Example</h3><p>Suppose your company provides a Java-based application.</p><p>An end user only needs the JRE installed to run the application.</p><p>They do not need development tools.</p><div><hr></div><h2>What is JDK?</h2><p>JDK stands for:</p><p><strong>Java Development Kit</strong></p><p>The JDK provides everything needed to develop Java applications.</p><p>Think of it as:</p><pre><code><code>JDK = JRE + Development Tools
</code></code></pre><p>The JDK contains:</p><ul><li><p>JRE</p></li><li><p>JVM</p></li><li><p>Java Compiler (javac)</p></li><li><p>Debugger</p></li><li><p>Documentation Tools</p></li><li><p>Development Utilities</p></li></ul><p>As developers, we install the JDK because we need to:</p><ul><li><p>Write code</p></li><li><p>Compile code</p></li><li><p>Debug applications</p></li><li><p>Run applications</p></li></ul><div><hr></div><h2>Visualizing the Relationship</h2><pre><code><code>+-------------------------+
|          JDK            |
|                         |
|  +-------------------+  |
|  |       JRE         |  |
|  |                   |  |
|  | +-------------+   |  |
|  | |    JVM      |   |  |
|  | +-------------+   |  |
|  +-------------------+  |
+-------------------------+
</code></code></pre><p>Remember:</p><p>JVM is inside JRE.</p><p>JRE is inside JDK.</p><div><hr></div><h2>Real-World Example</h2><p>Imagine you&#8217;re building a Spring Boot application.</p><h3>Developer Machine</h3><p>Needs:</p><ul><li><p>JDK</p></li></ul><p>Because developers must:</p><ul><li><p>Write code</p></li><li><p>Compile code</p></li><li><p>Run code</p></li></ul><h3>Production Server</h3><p>Needs:</p><ul><li><p>JRE (historically)</p></li></ul><p>Because it only needs to run the application.</p><h3>JVM</h3><p>Works behind the scenes in both cases to execute the bytecode.</p><div><hr></div><h2>Interview Questions</h2><h3>1. What is JVM?</h3><p>The JVM is a virtual machine that executes Java bytecode and enables platform independence.</p><div><hr></div><h3>2. What is JRE?</h3><p>The JRE provides the environment required to run Java applications.</p><p>It contains the JVM and Java runtime libraries.</p><div><hr></div><h3>3. What is JDK?</h3><p>The JDK is a complete development kit that contains the JRE and development tools such as the Java compiler.</p><div><hr></div><h3>4. Which one should a Java developer install?</h3><p>A Java developer should install the JDK because it includes everything needed for development and execution.</p><div><hr></div><h3>5. Does JDK contain JRE?</h3><p>Yes.</p><p>The JDK contains the JRE, and the JRE contains the JVM.</p><div><hr></div><h2>Key Takeaways</h2><ul><li><p>JVM executes Java bytecode.</p></li><li><p>JRE provides the runtime environment.</p></li><li><p>JDK provides development tools.</p></li><li><p>JDK contains JRE.</p></li><li><p>JRE contains JVM.</p></li><li><p>Developers use JDK.</p></li><li><p>JVM is responsible for platform independence.</p></li></ul><p>In the next blog, we&#8217;ll explore:</p><p><strong>How Java Code Gets Executed: From Source Code to Output</strong></p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://gauravrshegekar.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading ByteCraft! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[Why Java is Platform Independent?]]></title><description><![CDATA[How the JVM Makes It Possible]]></description><link>https://gauravrshegekar.substack.com/p/why-java-is-platform-independent</link><guid isPermaLink="false">https://gauravrshegekar.substack.com/p/why-java-is-platform-independent</guid><dc:creator><![CDATA[Gaurav Shegekar]]></dc:creator><pubDate>Thu, 18 Jun 2026 15:31:34 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/dfc022fe-9bdf-468d-ae5d-818382192242_1730x909.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>One of Java&#8217;s most famous features is its ability to run on different operating systems without changing the source code.</p><p>This capability is known as <strong>Platform Independence</strong> and is often summarized by Java&#8217;s famous slogan:</p><p><strong>&#8220;Write Once, Run Anywhere (WORA).&#8221;</strong></p><p>But how is Java able to achieve something that many traditional programming languages cannot?</p><p>To answer that question, we first need to understand the problem Java was created to solve.</p><div><hr></div><h2>The Problem with Traditional Compiled Languages</h2><p>Consider a language like C or C++.</p><p>When you compile a C program on Windows, the compiler generates machine code specifically for Windows.</p><p>That machine code understands the Windows operating system and processor architecture.</p><p>If you want the same application to run on Linux, you typically need to recompile the source code for Linux.</p><p>This means:</p><ul><li><p>One source code</p></li><li><p>Multiple compilations</p></li><li><p>Multiple platform-specific binaries</p></li></ul><p>Maintaining applications across multiple operating systems becomes difficult and expensive.</p><div><hr></div><h2>Java&#8217;s Solution</h2><p>Java introduced a different approach.</p><p>Instead of converting source code directly into machine code, Java converts source code into an intermediate format called:</p><p><strong>Bytecode</strong></p><p>This bytecode is stored inside a <code>.class</code> file.</p><p>The key idea is:</p><p>Java source code is compiled only once.</p><p>The generated bytecode can then run on any operating system that has a Java Virtual Machine (JVM).</p><div><hr></div><h2>The Java Execution Flow</h2><p>Let&#8217;s look at a simple Java program:</p><pre><code><code>public class Main {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}
</code></code></pre><p>When you compile it:</p><pre><code><code>javac Main.java
</code></code></pre><p>Java creates:</p><pre><code><code>Main.class
</code></code></pre><p>This <code>.class</code> file contains bytecode, not machine code.</p><p>When you run:</p><pre><code><code>java Main
</code></code></pre><p>The JVM reads the bytecode and converts it into machine instructions that the operating system understands.</p><div><hr></div><h2>What is JVM?</h2><p>JVM stands for <strong>Java Virtual Machine</strong>.</p><p>It acts as a bridge between Java bytecode and the operating system.</p><p>Think of the JVM as a translator.</p><p>The JVM understands:</p><ul><li><p>Java Bytecode</p></li></ul><p>And converts it into:</p><ul><li><p>Windows Instructions</p></li><li><p>Linux Instructions</p></li><li><p>macOS Instructions</p></li></ul><p>depending on where the application is running.</p><div><hr></div><h2>How Platform Independence Works</h2><p>The magic lies in the JVM.</p><p>Suppose you compile a Java application on Windows.</p><p>The generated bytecode can be copied to:</p><ul><li><p>Linux</p></li><li><p>macOS</p></li><li><p>Ubuntu Server</p></li><li><p>Cloud Servers</p></li></ul><p>As long as a JVM is installed, the same bytecode can run without modification.</p><p>This means:</p><pre><code><code>Java Source Code
        |
        v
     Compiler
        |
        v
   Bytecode (.class)
        |
   -----------------
   |       |       |
 Windows Linux macOS
   JVM    JVM   JVM
   |       |      |
Machine Machine Machine
 Code    Code   Code
</code></code></pre><p>The source code doesn&#8217;t change.</p><p>Only the JVM implementation changes for each operating system.</p><div><hr></div><h2>Why is This Important?</h2><p>Platform independence provides several advantages:</p><h3>Reduced Development Effort</h3><p>Developers write code once instead of maintaining separate codebases.</p><h3>Easier Deployment</h3><p>Applications can run on different environments without recompilation.</p><h3>Better Portability</h3><p>Moving applications between operating systems becomes simple.</p><h3>Enterprise Adoption</h3><p>Large organizations often use multiple operating systems.</p><p>Java allows the same application to run across all of them.</p><div><hr></div><h2>Real-World Example</h2><p>Imagine you&#8217;re building a Spring Boot application on your Windows laptop.</p><p>After deployment:</p><ul><li><p>Development Team uses Windows</p></li><li><p>Testing Team uses Linux</p></li><li><p>Production Server runs Ubuntu</p></li></ul><p>Because Java generates bytecode, the same application can run across all environments using their respective JVMs.</p><p>No code changes are required.</p><div><hr></div><h2>Interview Questions</h2><h3>1. Why is Java called Platform Independent?</h3><p>Java source code is compiled into bytecode, which can run on any operating system that has a JVM installed.</p><div><hr></div><h3>2. What role does the JVM play?</h3><p>The JVM converts Java bytecode into machine-specific instructions that the operating system can execute.</p><div><hr></div><h3>3. What is Bytecode?</h3><p>Bytecode is an intermediate representation of Java code generated by the Java compiler.</p><div><hr></div><h3>4. Can Java run without a JVM?</h3><p>No.</p><p>The JVM is responsible for executing Java bytecode.</p><p>Without a JVM, bytecode cannot be executed.</p><div><hr></div><h2>Key Takeaways</h2><ul><li><p>Traditional languages generate platform-specific machine code.</p></li><li><p>Java generates platform-independent bytecode.</p></li><li><p>The JVM translates bytecode into machine code.</p></li><li><p>Different operating systems have different JVM implementations.</p></li><li><p>This architecture enables Java&#8217;s famous &#8220;Write Once, Run Anywhere&#8221; capability.</p></li></ul><p>In the next blog, we&#8217;ll explore the three terms every Java developer hears but often confuses:</p><p><strong>JDK vs JRE vs JVM  Understanding the Difference.</strong></p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://gauravrshegekar.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading ByteCraft! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[What is Java?]]></title><description><![CDATA[Understanding the Language That Powers Millions of Applications]]></description><link>https://gauravrshegekar.substack.com/p/what-is-java</link><guid isPermaLink="false">https://gauravrshegekar.substack.com/p/what-is-java</guid><dc:creator><![CDATA[Gaurav Shegekar]]></dc:creator><pubDate>Thu, 18 Jun 2026 04:10:20 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/266fafd0-6701-445c-9c6a-aac13ef05bcc_1731x909.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If you&#8217;ve ever used an Android application, booked a train ticket online, used an ATM, or accessed a large enterprise application, chances are Java was working behind the scenes.</p><p>Java is one of the most popular programming languages in the world and has been trusted by developers and companies for nearly three decades. Despite the emergence of newer languages, Java continues to power banking systems, e-commerce platforms, enterprise software, cloud applications, and large-scale backend systems.</p><p>In this blog, we&#8217;ll understand what Java is, why it was created, and why it remains one of the most in-demand programming languages today.</p><div><hr></div><h2>The Problem Before Java</h2><p>Before Java was introduced, developers often faced a common challenge:</p><p>A program written for one operating system would not necessarily work on another operating system.</p><p>For example:</p><ul><li><p>A program compiled on Windows might not run on Linux.</p></li><li><p>A program built on Linux might require modifications before running on macOS.</p></li></ul><p>This created significant development and maintenance overhead.</p><p>There was a need for a language that could allow developers to write code once and run it anywhere.</p><div><hr></div><h2>What is Java?</h2><p>Java is a high-level, object-oriented, class-based programming language developed by Sun Microsystems in 1995.</p><p>Its primary goal was to provide platform independence through the famous principle:</p><p><strong>&#8220;Write Once, Run Anywhere (WORA).&#8221;</strong></p><p>Instead of converting source code directly into machine code, Java converts source code into an intermediate form called <strong>Bytecode</strong>.</p><p>This bytecode can run on any system that has a Java Virtual Machine (JVM).</p><div><hr></div><h2>Simple Java Program</h2><pre><code><code>public class Main {
    public static void main(String[] args) {
        System.out.println("Hello, Java!");
    }
}</code></code></pre><p>Output:</p><pre><code><code>Hello, Java!</code></code></pre><p>Although this program looks simple, several things happen behind the scenes:</p><ol><li><p>The Java compiler converts the source code into bytecode.</p></li><li><p>The JVM loads the bytecode.</p></li><li><p>The JVM executes the instructions on the target machine.</p></li><li><p>The output is displayed to the user.</p></li></ol><p>We&#8217;ll explore this process in future blogs.</p><div><hr></div><h2>Key Features of Java</h2><h3>1. Platform Independent</h3><p>Java code can run on different operating systems without modification.</p><h3>2. Object-Oriented</h3><p>Java follows Object-Oriented Programming principles such as:</p><ul><li><p>Encapsulation</p></li><li><p>Inheritance</p></li><li><p>Polymorphism</p></li><li><p>Abstraction</p></li></ul><p>These concepts help developers build scalable and maintainable applications.</p><h3>3. Secure</h3><p>Java provides features such as:</p><ul><li><p>Bytecode verification</p></li><li><p>Runtime security checks</p></li><li><p>Automatic memory management</p></li></ul><p>These features make Java suitable for enterprise applications.</p><h3>4. Robust</h3><p>Java has strong exception handling and automatic garbage collection, reducing common programming errors.</p><h3>5. Scalable</h3><p>Java is used by organizations that serve millions of users because it performs well under large workloads.</p><div><hr></div><h2>Where is Java Used?</h2><p>Java is widely used in:</p><h3>Banking Systems</h3><p>Applications that handle transactions, payments, and account management.</p><h3>E-Commerce Platforms</h3><p>Managing orders, inventory, and user accounts.</p><h3>Enterprise Applications</h3><p>Large business software used by organizations.</p><h3>Cloud Applications</h3><p>Modern distributed systems and microservices.</p><h3>Android Development</h3><p>Many Android applications have historically been built using Java.</p><div><hr></div><h2>Why Should You Learn Java in 2026?</h2><p>Java remains one of the most sought-after skills for backend developers.</p><p>Learning Java opens opportunities in:</p><ul><li><p>Backend Development</p></li><li><p>Enterprise Software Development</p></li><li><p>Cloud Computing</p></li><li><p>Microservices Architecture</p></li><li><p>FinTech Applications</p></li><li><p>High-Scale Systems</p></li></ul><p>Many companies continue to use Java because of its stability, reliability, and mature ecosystem.</p><div><hr></div><h2>Interview Questions</h2><h3>1. What is Java?</h3><p>Java is a high-level, object-oriented programming language designed to be platform independent.</p><h3>2. Who developed Java?</h3><p>Java was developed by Sun Microsystems and later acquired by Oracle.</p><h3>3. What is the main advantage of Java?</h3><p>Its ability to run on different operating systems through the Java Virtual Machine (JVM).</p><h3>4. Why is Java called platform independent?</h3><p>Because Java code is compiled into bytecode, which can run on any machine with a JVM installed.</p><div><hr></div><h2>Key Takeaways</h2><ul><li><p>Java is a high-level, object-oriented programming language.</p></li><li><p>It follows the principle &#8220;Write Once, Run Anywhere.&#8221;</p></li><li><p>Java achieves platform independence using the JVM.</p></li><li><p>It is widely used in enterprise, banking, e-commerce, and cloud applications.</p></li><li><p>Java remains one of the most valuable skills for backend developers.</p></li></ul><p>In the next blog, we&#8217;ll explore one of Java&#8217;s most famous features:</p><p><strong>Why Java is Platform Independent and How the JVM Makes It Possible.</strong></p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://gauravrshegekar.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading ByteCraft! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item></channel></rss>