Skip to main content

ProwessApps

Learn · Practice · Excel

Java Basics

Introduction to Java Programming

Java is a high-level, class-based programming language used to create backend services, enterprise software, desktop applications, development tools, and Android applications. This lesson explains how Java source code becomes bytecode and how the Java Virtual Machine runs it.

9 min read Beginner Lesson 1 of 124
Lesson 1 of 124 in the Java roadmap

Quick answer

What is Java?

Java is a high-level, strongly typed, class-based programming language. A Java compiler converts source code into bytecode, and a compatible Java Virtual Machine loads and executes that bytecode. This design allows the same compiled program to run across supported platforms without recompiling it for each operating system.

What you will learn

  • What Java is and where it is commonly used.
  • How source code, bytecode, and the JVM work together.
  • How to read and run a small Java program.

Before you begin

No previous programming experience is required. Basic computer knowledge is enough to start.

What is Java programming?

Java was designed to let developers write structured programs that can run on systems with a compatible JVM. Java uses static types, classes, methods, automatic memory management, and exception handling to support maintainable applications.

How does Java work?

  1. You write source code in a file ending with .java.
  2. The Java compiler checks the source code and creates bytecode in a .class file.
  3. The JVM loads, verifies, and executes the bytecode.
Source code Java compiler Bytecode JVM

Your first Java program

The following program prints a message to the console.

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

Output

Hello, Java!

How the program works

  • public class HelloJava declares a class named HelloJava. In Java, all code must be inside a class.
  • public static void main(String[] args) is the entry point used to start this program. Here's a breakdown:
    • public: The method is accessible from other classes, including the Java launcher that invokes main().
    • static: The JVM can invoke main() without first creating an instance of the HelloJava class.
    • void: The method does not return a value.
    • main: The conventional entry-point method name used by the Java launcher.
    • String[] args: An array of strings that stores command-line arguments passed to the program when it starts.
  • System.out.println() prints text followed by a new line.

Brief history of Java

Java emerged from Sun Microsystems’ Green Project in 1991. The development team was led by James Gosling and initially focused on portable software for consumer electronic devices.

The language was known as Oak during early development. It was later renamed Java after trademark concerns with the Oak name.

Java was publicly introduced in 1995, and JDK 1.0 was released in January 1996.

Why Learn Java?

  • Structured learning path: Java introduces variables, conditions, loops, methods, classes, exceptions, and collections in a systematic way.
  • Broad professional use: Java is used across enterprise software, backend systems, developer tools, and Android-related codebases.
  • Widely used in enterprise applications.
  • Excellent support for object-oriented programming.
  • Large community and learning resources.
  • Platform Independent: Java follows the principle of WORAWrite Once, Run Anywhere.

Where is Java used?

  • Backend services and enterprise applications
  • Banking, payment, and transaction-processing systems
  • Android applications and shared mobile libraries
  • Desktop tools, IDEs, build systems, and developer utilities
  • Cloud services, messaging systems, and distributed applications

Common beginner mistakes

  • The public class name and filename do not match.
  • Missing or mismatched curly braces {}. Every opening brace must have a closing brace.
  • A semicolon is missing at the end of a statement.
  • Uppercase and lowercase letters are treated as interchangeable even though Java is case-sensitive.
Don't do this
System.out.println("Hello") // Missing semicolon!
Do this
System.out.println("Hello");

What's Next?

Now that you know how Java works, in the next lesson we'll dive into the Features of Java to see why it remains one of the most popular programming languages in the world!

Lesson summary

  • Java source code is compiled into bytecode.
  • A JVM executes Java bytecode on a supported platform.
  • Java is used for backend, enterprise, desktop, Android, and cloud applications.

Frequently asked questions

What is Java?

Java is a high-level, strongly typed, class-based programming language used for backend services, enterprise applications, developer tools, desktop applications, and Android-related codebases.

What is a JVM?

A Java Virtual Machine is a runtime environment that loads, verifies, and executes compiled Java bytecode.

Why is Java platform independent?

Java source code is compiled into bytecode. The same bytecode can run on operating systems and hardware platforms that provide a compatible JVM.

Check Your Knowledge

Track your Java progress

Sign in to save completed lessons and continue from another device.

Sign in to track progress

Java Tutorial for Beginners

Choose a lesson