Introduction to Java: Where to Start in 2025 in Practice
Java remains one of the most in-demand programming languages in the world. In 2025, it still holds leading positions in enterprise development, Android applications, backend, and big data. If you have decided to start learning Java, this guide will help you take your first steps with minimal theory and maximum practice. We will set up the environment, write our first program, and cover the basic language constructs.
1. Installing and Setting Up the Development Environment
Before writing code, you need to install the Java Development Kit (JDK). In 2025, I recommend using JDK 21 LTS (Long-Term Support) or newer.
Step 1. Downloading the JDK
Go to the official Oracle website or use OpenJDK. For simplicity, download the installer for your operating system:
- Windows: an installer .exe file
- macOS: a .dmg file
- Linux: via a package manager (e.g.,
sudo apt install openjdk-21-jdk)
Step 2. Verifying the Installation
Open a terminal (command line) and run:
java -versionjavac -versionYou should see the version of the installed Java. If the commands are not found, add the path to the bin folder to the PATH environment variable.
Step 3. Choosing an IDE (Integrated Development Environment)
For beginners, the following are suitable:
- IntelliJ IDEA Community Edition (free) — the best choice for Java
- Eclipse — a classic, with many plugins
- VS Code + the Java Extension Pack — a lightweight option
2. Your First Java Program: "Hello, World!"
Traditionally, we start by printing a greeting. Create a file HelloWorld.java and write:
public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, Java 2025 World!"); }}Compilation and Execution
In the terminal, navigate to the folder with the file and run:
javac HelloWorld.javajava HelloWorldYou will see the output: Hello, Java 2025 World!
Code Breakdown:
public class HelloWorld— class declaration. The class name must match the file name.public static void main(String[] args)— the entry point of the program.System.out.println()— a method for printing a string to the console.
3. Basic Syntax: Variables, Data Types, and Operators
Java is a strongly typed language. This means every variable has a type that must be specified.
Primitive Data Types
int age = 25; // integerdouble price = 19.99; // floating-point numberboolean isActive = true;// boolean valuechar grade = 'A'; // characterbyte b = 100; // 8-bit integerlong bigNumber = 100000L;// large integer (suffix L)Strings
Strings in Java are objects of the String class. They can be declared like primitives thanks to syntactic sugar:
String name = "Anna";String greeting = "Hello, " + name;System.out.println(greeting); // Hello, AnnaConditional Statements
int temperature = 30;if (temperature > 25) { System.out.println("Hot");} else if (temperature > 15) { System.out.println("Warm");} else { System.out.println("Cold");}Loops
For loop:
for (int i = 0; i < 5; i++) { System.out.println("Iteration: " + i);}While loop:
int count = 0;while (count < 3) { System.out.println("Count: "