Free tutorials & notes in Hindi & English · Clean code examples 🧰 Free PDF & Image Tools →
🟢 Foundation  ·  Lesson 01

Introduction to Java – What is Java?

In this lesson: Java for beginners — what it is, why it is popular, key features and how the JVM makes it platform-independent, with a first program.

What is Java

Java is one of the world's most popular programming languages. It is general-purpose, meaning you can build almost anything with it — Android apps, websites, banking software and huge business systems. Java is known for being reliable, secure, and able to run on any device through the Java Virtual Machine (JVM).

💡 Java's famous promise is "write once, run anywhere" — the same program runs on any device with a JVM.

Why Java is popular

  • Everywhere. Android apps, banks, and big companies run on Java.
  • Platform-independent. The same code runs on Windows, Mac and Linux.
  • Strong OOP. Java teaches object-oriented programming clearly.
  • Great for jobs. It is heavily used in placements and interviews.

Key features

FeatureMeaning
Platform-independentRuns anywhere with a JVM
Object-orientedBuilt around classes and objects
SecureRuns in a controlled JVM environment
RobustStrong error and memory handling
Automatic memoryGarbage collector frees unused memory

Write once, run anywhere

This is Java's biggest strength. Your code is compiled into bytecode — a middle form that is not tied to any one operating system. The JVM on each device runs that bytecode. So you write and compile once, and the same program runs on Windows, Mac, Linux and Android alike.

How Java runs

  1. You write Java code in a .java file.
  2. The Java compiler (javac) turns it into bytecode (a .class file).
  3. The JVM reads the bytecode and runs it on your device.
  4. Because every platform has its own JVM, the same bytecode runs everywhere.

So Java is both compiled (to bytecode) and interpreted (by the JVM) — that combination gives it portability.

A first look

public class Hello {
    public static void main(String[] args) {
        System.out.println("Hello, Java!");
    }
}
Output:
Hello, Java!

Every Java program lives in a class, and running starts from the main method. System.out.println prints a line of text. We will break this down fully in the next lessons.

Common mistakes

  • Confusing Java with JavaScript. They are completely different languages.
  • Thinking Java is old and unused. It runs Android and most large enterprise systems today.
  • Forgetting the JVM. Java needs the JVM (part of the JDK/JRE) installed to run.
  • Expecting to run .java directly. It must be compiled to bytecode first.

Summary

  • Java is a popular, general-purpose, object-oriented language.
  • It is platform-independent: "write once, run anywhere" via the JVM.
  • Code compiles to bytecode, which the JVM runs on any device.
  • It powers Android, banking and enterprise software, and is big in jobs.
  • Every program starts from the main method inside a class.

Next, install Java with the Java setup guide, or understand the engine in JDK, JRE and JVM.

Frequently Asked Questions

What is Java in simple words?
Java is a popular, general-purpose programming language used to build apps, websites, Android apps and large business systems. It is known for being reliable, secure, and able to run on any device that has the Java Virtual Machine (JVM).
Why is Java called platform-independent?
Java code is compiled into bytecode, which runs on the JVM rather than directly on the operating system. Any device with a JVM can run that bytecode, so the same program works on Windows, Mac and Linux — "write once, run anywhere".
Is Java still worth learning?
Yes. Java powers Android apps, banking systems, and huge enterprise software, and it is heavily used in placements and jobs. Its strong fundamentals also make it a great language to learn object-oriented programming.
What is the difference between Java and JavaScript?
Despite the similar name, they are different languages. Java is a general-purpose, compiled language often used for apps and backends. JavaScript is mainly for making web pages interactive in the browser. The names are a historical coincidence.
What is the JVM?
The JVM (Java Virtual Machine) is the engine that runs Java bytecode. It sits between your compiled program and the operating system, which is what lets the same Java program run on different platforms.
← Back to Java Tutorial
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

💻 Live Code Editor

This page's programs are ready here — run them, edit them, and learn. No installation needed.
Powered by OneCompiler. The code loads into the editor automatically — press Run to see the output. If the editor does not open, open it in a new tab.
Next topicJDK, JRE and JVM Your progress: 1 / 61 (2%) · Lesson 2 / 61 Continue →

How was this lesson?

Your feedback helps us make the content better.

Write a review or suggestion (optional)

After approval, your name and city may appear publicly with your review. Please do not write your email or phone number.

▶ CodingEasily on YouTube

Learn with video lessons in easy Hindi

Featured video: RDBMS Part 3 – Class XI Commerce IT

▶ Subscribe – it’s free