Why Java? The JVM Philosophy & Write Once, Run Anywhere

Java কেন শিখবেন — JVM দর্শন ও Write Once Run Anywhere

Read: ~25 min Beginner 5 practice problems Live code runner

1. Before We Begin — What Is Java?

Java is a statically-typed, object-oriented, compiled-to-bytecode programming language designed to run unchanged on any device with a Java Virtual Machine. It was created at Sun Microsystems in the mid-1990s with a radical promise — Write Once, Run Anywhere — and for the last thirty years that promise has quietly powered a staggering portion of the world's software: Android, most large banks, Netflix, LinkedIn, Amazon's core, and a huge share of Bangladesh's fintech and banking stack.

Java একটি statically-typed, object-oriented, bytecode-compiled ভাষা, যা Java Virtual Machine (JVM) আছে এমন যেকোনো ডিভাইসে অপরিবর্তিত চলে। ১৯৯০-এর দশকের মাঝামাঝি Sun Microsystems-এ এটি তৈরি হয়েছিল একটি বৈপ্লবিক প্রতিশ্রুতি নিয়ে — Write Once, Run Anywhere। গত ত্রিশ বছরে এই প্রতিশ্রুতিই পৃথিবীর বিশাল অংশ সফটওয়্যারকে চালিয়েছে — Android ফোন, বেশির ভাগ ব্যাংক, Netflix, LinkedIn, Amazon-এর কোর সিস্টেম, এবং বাংলাদেশের ফিনটেক ও ব্যাংকিং stack-এর বিশাল একটি অংশ।

Hundreds of programming languages exist. So why start with Java? This module gives the full answer.

2. A Short History of Java

In 1991, at Sun Microsystems, an engineer named James Gosling started work on a language originally called Oak for interactive television. TV didn't pan out — but the language did. Renamed Java in 1995, it quickly captured the exploding internet. Applets in browsers gave way to server-side Java, then Android, then cloud.

১৯৯১ সালে Sun Microsystems-এ James Gosling নামে একজন প্রকৌশলী একটি নতুন ভাষা তৈরি শুরু করেন — প্রথমে নাম ছিল Oak, উদ্দেশ্য ছিল interactive TV। TV বাজার সফল হয়নি, কিন্তু ভাষাটি হয়। ১৯৯৫ সালে নাম বদলে হয় Java, এবং দ্রুত বেড়ে ওঠা ইন্টারনেট জগৎ এটিকে গ্রহণ করে। Browser-এর applet থেকে শুরু করে server-side Java, তারপর Android, তারপর cloud।

Thirty years on, Java is still the #1 or #2 language by volume in enterprise software, Android, and fintech. The reason is simple: compile once, ship the bytecode, and it just runs — everywhere the JVM runs.

1991Oak project 1995Java 1.0 2008Android launches 2014Java 8 (Lambdas) 2021Java 17 LTS 2023Java 21 LTS Figure 1.1 — Java-এর সংক্ষিপ্ত ইতিহাস এবং প্রধান LTS রিলিজ।

3. The JVM — Write Once, Run Anywhere

Unlike C (which compiles directly to x86/ARM machine code) and unlike Python (which is interpreted line by line), Java takes a middle path. The javac compiler turns your .java source into bytecode — a compact, machine-independent instruction set. A Java Virtual Machine (JVM) on the target device then executes that bytecode, often translating hot spots into native machine code on the fly via the JIT (Just-In-Time) compiler.

C সরাসরি CPU-র machine code-এ compile হয় (তাই চালানোর জন্য নির্দিষ্ট architecture লাগে)। Python line-by-line interpret হয় (তাই ধীর)। Java মাঝামাঝি পথ নেয় — javac আপনার কোডকে bytecode-এ rules করে, যা machine-independent। যে ডিভাইসে চালাবেন সেখানকার JVM সেই bytecode চালায়, এবং প্রয়োজনে JIT compiler hot অংশ native code-এ পরিণত করে — তাই দ্রুত।
Java = Compiled to Bytecode + JVM Execution Main.java (source) javac compiler (compile once) Main.class (bytecode) JVM (Linux / Win / Mac) One .class file · Runs on any JVM · JIT → native at runtime Windows JVM · Linux JVM · macOS JVM · Android ART · Mobile · Server · Cloud Figure 1.2 — Java compile করে bytecode হয়; JVM সেই bytecode যেকোনো platform-এ চালায়।

4. Your First Java Program — Run It Live 🚀

Below is the complete Hello-World program in Java. Click Run ▶ to compile and execute it right here in your browser. No installation required.

নিচে সম্পূর্ণ Hello-World প্রোগ্রামটি দেওয়া হলো। কোনো কিছু install না করেই সরাসরি ব্রাউজারে Run ▶ বাটনে ক্লিক করে এটি চালিয়ে দেখা যাবে। ব্রাউজার এটিকে Wandbox cloud compiler-এ পাঠিয়ে compile ও run করে ফলাফল দেখাবে।
Main.java
// My first Java program
class Main {
    public static void main(String[] args) {
        System.out.println("Hello, Bangladesh!");
        System.out.println("হ্যালো বাংলাদেশ!");

        // Variables are always typed in Java
        String site = "ABCL TECH";
        int year = 2025;
        System.out.println("Welcome to " + site + " in " + year);
    }
}
Classroom convention: throughout this course we use class Main (package-private) instead of public class Main — the Wandbox sandbox compiles source as prog.java, and a public class must match the filename. In your own IDE you can absolutely say public class Main in Main.java.
Anatomy — প্রতিটি অংশের কাজ
PieceMeaningবাংলায়
class MainDeclares a class named Main — every Java program lives inside a class.একটি class-এর নাম ঘোষণা — প্রতিটি Java প্রোগ্রাম class-এর ভেতরে থাকে।
public static void mainThe entry point — the JVM looks for this exact signature.প্রোগ্রাম যেখান থেকে শুরু — JVM এই signature-টিই খোঁজে।
String[] argsCommand-line arguments passed to the program.command line থেকে পাঠানো argument।
System.out.printlnPrints a line to stdout, followed by a newline.স্ক্রিনে টেক্সট দেখানোর পর নতুন লাইনে চলে যায়।
String site = "..."Declare a String variable and initialize it.একটি String ভ্যারিয়েবল ঘোষণা ও মান সেট।

5. Where Java Is Used Today (Java আজ কোথায় ব্যবহৃত হয়)

Android Apps
Billions of phones — Java (and Kotlin, which targets the JVM) runs on each one।
Banking & Fintech
Nearly every major bank, and a huge share of Bangladesh's banking & MFS stack।
Enterprise Backends
Netflix, LinkedIn, Uber, Amazon — Spring Boot microservices at massive scale।
Big Data
Hadoop, Kafka, Cassandra, Elasticsearch — Java-native infrastructure।
Games & Tools
Minecraft, JetBrains IDEs (IntelliJ), and much of build tooling।
Scientific Computing
NASA uses Java for mission control software and numerous modeling tools।

6. The Trade-offs — Java Is Not a Free Lunch

✅ What Java Gives You (যা পাবেন)

  • Write Once, Run Anywhere — same bytecode on all platforms
  • Strong static typing — catch bugs at compile time
  • Automatic memory management (GC) — no manual malloc/free
  • Rich standard library & the world's largest OSS ecosystem
  • Mature JVM: decades of tuning, profilers, production experience

⚠️ What Java Asks of You (দায়িত্ব)

  • Verbose syntax compared to Python or Kotlin
  • Slower startup than C binaries (JVM boot time)
  • Higher memory use than C/Rust
  • OOP discipline — harder for pure scripting
  • Learning the ecosystem (Maven, Spring, JVM) takes time
Key insight Java trades a few keystrokes for safety, portability, and a thirty-year track record in production. For large teams and long-lived systems, that trade is exactly right.

Java কিছু অতিরিক্ত কীস্ট্রোক-এর বিনিময়ে দেয় নিরাপত্তা, portability ও তিন দশকের production ট্র্যাক রেকর্ড। বড় টিম ও দীর্ঘমেয়াদি সিস্টেমের জন্য এই বিনিময়টি সঠিক।

7. Vocabulary for This Course (কোর্সের শব্দভাণ্ডার)

TermMeaningবাংলায়
JDKJava Development Kit — compiler + JVM + tools.Java Development Kit — compiler, JVM ও টুলসের সেট।
JVMJava Virtual Machine — executes bytecode.Java Virtual Machine — bytecode চালানোর ইঞ্জিন।
JREJava Runtime Environment — JVM + standard library.JVM + standard library — শুধু চালানোর জন্য।
BytecodeCompact, platform-independent code stored in .class files..class ফাইলে থাকা platform-independent কোড।
JITJust-In-Time compiler — bytecode → native at runtime.Runtime-এ bytecode-কে native code-এ পরিণত করে, তাই দ্রুত।
LTSLong-Term Support — a version with 8+ years of updates.Long-Term Support — বহু বছর security update পাওয়া সংস্করণ।

8. Practice Problems

Every problem has a Show Answer button. The answer contains real Java code that you can run right here. Try the problem yourself first, then check.

প্রতিটি প্রশ্নের সাথে Show Answer বাটন রয়েছে। উত্তরে একটি চালু-করার-যোগ্য Java কোড দেওয়া আছে, যা আপনি সরাসরি এই পেজেই রান করে দেখতে পারবেন। প্রথমে নিজে চেষ্টা করুন, তারপর উত্তর মিলিয়ে নিন।
  1. Write a program that prints your name on the first line and your university on the second line.
    এমন একটি প্রোগ্রাম লিখুন যা প্রথম লাইনে আপনার নাম এবং দ্বিতীয় লাইনে আপনার বিশ্ববিদ্যালয়ের নাম প্রিন্ট করবে।
    ✨ Show Answer (উত্তর দেখুন)
    Main.java
    class Main {
        public static void main(String[] args) {
            System.out.println("Name: Arif Hossain");
            System.out.println("University: NSU");
        }
    }
  2. Use a single System.out.println with \n to print three lines.
    একটি মাত্র System.out.println এবং \n দিয়ে তিন লাইনের একটি greeting প্রিন্ট করুন।
    ✨ Show Answer (উত্তর দেখুন)
    Main.java
    class Main {
        public static void main(String[] args) {
            System.out.println("Hello!\nWelcome to Java.\nLet's build something great.");
        }
    }
  3. Explain in 3 sentences why most Android apps are written in Java/Kotlin and not Python.
    তিন বাক্যে ব্যাখ্যা করুন — বেশির ভাগ Android অ্যাপ Python-এর পরিবর্তে Java/Kotlin-এ কেন লেখা হয়।
    ✨ Show Answer (উত্তর দেখুন)

    Answer: (1) Android was built from day one on the JVM (via Dalvik, now ART), so Java/Kotlin are the native platform languages. (2) The Android framework and every system API are defined in Java, and mobile apps need close, fast access to those APIs. (3) Static typing and AOT/JIT compilation give Android apps the performance and battery efficiency that a heavy interpreter like CPython cannot match on constrained mobile hardware.

    (১) Android প্রথম দিন থেকেই JVM-এর উপর (Dalvik, এখন ART) তৈরি, তাই Java/Kotlin-ই platform-এর native ভাষা। (২) Android-এর framework এবং সব system API Java-তে সংজ্ঞায়িত, mobile অ্যাপের সেই API-এ দ্রুত access দরকার। (৩) Static typing ও AOT/JIT compilation mobile hardware-এ CPython-এর মতো heavy interpreter-এর তুলনায় অনেক ভালো performance ও battery efficiency দেয়।

  4. Write a program that stores the seconds in a day in an int variable and prints it.
    একটি প্রোগ্রাম লিখুন যা int variable-এ এক দিনের সেকেন্ড রেখে প্রিন্ট করবে।
    ✨ Show Answer (উত্তর দেখুন)
    Main.java
    class Main {
        public static void main(String[] args) {
            int secondsPerDay = 24 * 60 * 60;
            System.out.println("One day has " + secondsPerDay + " seconds.");
        }
    }

    Output: One day has 86400 seconds.

  5. In one paragraph, explain who James Gosling is and why Java's "bytecode + JVM" model matters.
    একটি অনুচ্ছেদে ব্যাখ্যা করুন — James Gosling কে এবং Java-র "bytecode + JVM" মডেল কেন গুরুত্বপূর্ণ।
    ✨ Show Answer (উত্তর দেখুন)

    Answer: James Gosling (born 1955) is a Canadian computer scientist who led the team at Sun Microsystems that created Java in the early 1990s. His key idea — compile source code to a portable bytecode that any JVM can execute — decoupled software from hardware. That meant a bank in Dhaka could ship the exact same .jar to a Windows desktop, a Linux server, and (later) an Android phone and have it just run. Nearly every modern language with a VM (C#/CLR, Scala, Kotlin) traces its architectural ancestry back to this model.

    James Gosling (জন্ম ১৯৫৫) একজন Canadian কম্পিউটার বিজ্ঞানী, যিনি Sun Microsystems-এ ১৯৯০-এর দশকের শুরুতে Java তৈরি করেন। তাঁর মূল ভাবনা — source কোডকে portable bytecode-এ compile করা — যা যেকোনো JVM চালাতে পারে — software-কে hardware থেকে বিচ্ছিন্ন করে দিয়েছে। ফলে ঢাকার একটি ব্যাংক একই .jar ফাইল Windows desktop, Linux server ও (পরে) Android ফোনে চালাতে পেরেছে। আধুনিক প্রায় সব VM-ভিত্তিক ভাষাই (C#/CLR, Scala, Kotlin) এই architecture-এর উত্তরসূরি।

Summary — Module 01

Java is a statically-typed, object-oriented, bytecode-compiled language created by James Gosling in 1995 with a single radical goal: Write Once, Run Anywhere. Source compiles to bytecode, the JVM executes it on any platform, and the JIT makes it fast. It runs on billions of Android phones, the world's largest banks, and some of the biggest web services on earth. Learning Java teaches you to think in objects and to write code that scales — from a single class today to an enterprise system tomorrow.

Java একটি statically-typed, object-oriented, bytecode-compiled ভাষা, যা ১৯৯৫ সালে James Gosling তৈরি করেন একটিই লক্ষ্য নিয়ে — Write Once, Run Anywhere। কোড compile করে bytecode হয়, JVM যেকোনো platform-এ সেটি চালায়, JIT দ্রুত করে। কোটি কোটি Android ফোন, পৃথিবীর বৃহত্তম ব্যাংক ও বড় web service-এ Java চলে। Java শেখার মাধ্যমে আপনি শিখবেন object-এ চিন্তা করতে এবং এমন কোড লিখতে যা ছোট থেকে শুরু হয়ে বড় enterprise system পর্যন্ত scale করতে পারে।

Next Module → Computational Thinking & Object-Oriented Design — কোড লেখার আগে কীভাবে object-এ চিন্তা করতে হয়।