<?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: Sakshi Hanwat</title>
    <description>The latest articles on DEV Community by Sakshi Hanwat (@sakshi_hanwat_5f5cbba3dbf).</description>
    <link>https://dev.to/sakshi_hanwat_5f5cbba3dbf</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%2F3648803%2F744130da-addf-402a-bef6-f3d71d1190d7.jpg</url>
      <title>DEV Community: Sakshi Hanwat</title>
      <link>https://dev.to/sakshi_hanwat_5f5cbba3dbf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sakshi_hanwat_5f5cbba3dbf"/>
    <language>en</language>
    <item>
      <title>Why Java Was Created — The Platform Independence Story</title>
      <dc:creator>Sakshi Hanwat</dc:creator>
      <pubDate>Tue, 16 Jun 2026 16:52:56 +0000</pubDate>
      <link>https://dev.to/sakshi_hanwat_5f5cbba3dbf/why-java-was-created-the-platform-independence-story-20m9</link>
      <guid>https://dev.to/sakshi_hanwat_5f5cbba3dbf/why-java-was-created-the-platform-independence-story-20m9</guid>
      <description>&lt;p&gt;I started learning Core Java today. Most tutorials just throw syntax at you, but I wanted to understand why Java even exists. Here's what I found.&lt;/p&gt;

&lt;h2&gt;
  
  
  The World Before Java
&lt;/h2&gt;

&lt;p&gt;Before Java, C and C++ were ruling the programming world. They were fast, relatively simple, and got the job done. So why did we need something new?&lt;br&gt;
One word: portability.&lt;br&gt;
When you write C++ code, a compiler converts it into machine code — the 0s and 1s your computer actually understands. But here's the catch: that machine code is tied to a specific platform.&lt;br&gt;
A platform = OS + Processor&lt;br&gt;
For example:&lt;/p&gt;

&lt;p&gt;Windows + Intel x86 = one platform&lt;br&gt;
macOS + ARM = a completely different platform&lt;/p&gt;

&lt;p&gt;The machine code generated for one platform cannot run on another. Why? Two reasons:&lt;/p&gt;

&lt;p&gt;Every OS has different system libraries — even something as simple as printing to console works differently on Windows vs macOS&lt;br&gt;
Every processor has a different ISA (Instruction Set Architecture) — basically the grammar that CPU understands. Intel speaks differently than ARM at the hardware level.&lt;/p&gt;

&lt;p&gt;So if you had a C++ app and wanted it to run on 3 different platforms, you had to compile it 3 separate times. In the 1990s when new devices were exploding — TVs, set-top boxes, embedded systems — this became a massive problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Java Did Differently — Bytecode + JVM
&lt;/h2&gt;

&lt;p&gt;Java introduced a two-step process instead of compiling directly to machine code.&lt;br&gt;
Step 1: Your .java source file is compiled by javac into bytecode — a .class file. Bytecode is not machine code. It's an intermediate code that no specific machine understands directly.&lt;br&gt;
Step 2: The bytecode is given to the JVM (Java Virtual Machine). JVM reads it and converts it into the native machine code of that platform and runs it.&lt;br&gt;
The magic here: bytecode is the same everywhere. Only JVM changes per platform.&lt;br&gt;
JVM itself is platform-dependent — there's a separate JVM for Windows, one for macOS, one for Linux. But once you compile your Java code to bytecode, that single .class file runs on all of them.&lt;br&gt;
This is Java's famous promise: WORA — Write Once, Run Anywhere.&lt;br&gt;
Inside JVM, there's also a JIT (Just-In-Time) compiler that makes things faster — instead of interpreting bytecode line by line every time, it compiles frequently used code into native machine code at runtime and caches it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Java Also Solved Two More Problems
&lt;/h2&gt;

&lt;p&gt;Simplicity — C++ had pointers, multiple inheritance, and manual memory management. Java removed all of these. It added garbage collection so memory is managed automatically.&lt;br&gt;
Security — When Java applets (small Java programs) ran inside browsers downloaded from the internet, there was a risk of malicious code. JVM solved this with a sandbox model — it runs bytecode in a restricted environment where the code cannot access your file system, memory, or network without explicit permission. Even if someone puts harmful code in a Java program, the JVM sandbox blocks unauthorized actions before they reach your actual system.&lt;br&gt;
Interestingly, JVM alone solves both portability and security. That's why it's the heart of Java.&lt;/p&gt;

&lt;h2&gt;
  
  
  One-Line Summary
&lt;/h2&gt;

&lt;p&gt;Java compiles your code to bytecode once. JVM on each platform converts that bytecode to machine code. That's how Java became platform independent — and changed programming forever.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'm Using to Learn
&lt;/h2&gt;

&lt;p&gt;Java Full Course 2026 by Coder Army on YouTube — highly recommend, explains internals not just syntax.&lt;/p&gt;

&lt;p&gt;This is Day 1 of my Java learning series. I'm sharing everything I learn, in my own words, as I go.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>java</category>
      <category>platformindependent</category>
      <category>javaconcepts</category>
    </item>
  </channel>
</rss>
