Java is one of the most popular programming languages in the world. According to the TIOBE index, it has consistently been in the top 3 languages for more than two decades.
Why Java in 2025?
Before diving into the technical details, it's important to understand what makes Java a relevant choice. This language is used in the critical systems of banks, government agencies, and major Internet companies. Netflix, Amazon, LinkedIn, Twitter — they are all built on Java.
Key benefits of Java for a beginner developer:
Write Once, Run Anywhere
Code written in Java runs on any platform with a JVM (Java Virtual Machine) installed. Have you developed an application on macOS? It will work on Windows and Linux without any changes.
Strict typing
Java forces you to explicitly specify variable types, which may seem redundant at first, but it teaches you to write predictable and reliable code. You will catch many errors at the compilation stage, not in production.
Huge ecosystem
Millions of ready-made libraries for any tasks. Need to work with JSON? There are Gson and Jackson. Build a REST API? Spring Boot will do it in ten minutes. Processing big data? Apache Hadoop and Spark are at your service.
Demand in the labor market
The demand for Java developers is consistently high, and salaries are competitive. Backend, Android, data processing systems — the choice of specializations is huge.
Installing and configuring the environment
Step 1: Installing JDK
JDK (Java Development Kit) is a set of tools for Java development. In 2025, I recommend starting with the latest LTS version (Long-Term Support). At the time of writing, this is Java 21.
For Windows:
Download OpenJDK from Adoptium (Eclipse Temurin) or Oracle JDK
Run the installer
Add the path to Java to the PATH environment variable
For macOS:
# Using Homebrew brew install openjdk@21 # Add to ~/.zshrc or ~/.bash_profile export PATH="/opt/homebrew/opt/openjdk@21/bin:$PATH"
For Linux (Ubuntu/Debian):
sudo apt update sudo apt install openjdk-21-jdk
Check the installation:
java -version javac -version
You should see information about the Java version. If no commands are found, check the PATH.
Step 2: Choosing an IDE
For serious work with Java, you need a good IDE. Three main options:
IntelliJ IDEA — the undisputed leader. Community Edition is free and contains everything you need to learn Java. Smart autocomplete, built-in debugger, Git integration, Maven and Gradle support out of the box.
Eclipse - an old-timer of the industry, completely free. A little slower than IDEA, but very functional.
Visual Studio Code — lightweight version with the Extension Pack for Java plugin. It's a good fit if you're used to VS Code, but for Java it's better to use a full-fledged IDE.
Tip: I recommend starting with IntelliJ IDEA Community Edition. Download it from the official JetBrains website, install it, and you're ready to go.
Structure of a Java program
Let's create the first project. In IntelliJ IDEA: File → New → Project → select Java, specify JDK, create a project.
Each Java program starts with a class and method main:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, Java World!");
}
}Let's take a look at it line by line:
public class HelloWorld — class declaration. In Java, everything is a class. The class name must match the file name (HelloWorld.java).
public static void main(String[] args) — the entry point to the program.
public— the method is available from anywherestatic— the method belongs to the class, not the objectvoid— the method returns nothingString[] args— array of command line arguments
System.out.println() — output text to the console with a line break.
To compile and run from the terminal:
javac HelloWorld.java # Compilation in HelloWorld.class java HelloWorld # Running the program

Syntax basics: variables and data types
Java is a strongly typed language. Each variable has a type that is specified in the declaration:
public class DataTypes {
public static void main(String[] args) {
// Integers
byte smallNumber = 127; // -128 to 127
short mediumNumber = 32000; // -32.768 to 32.767
int regularNumber = 1000000; // -2^31 to 2^31-1
long bigNumber = 9000000000L; // -2^63 to 2^63-1 (L at the end!)
// Floating point numbers
float price = 19.99f; // 32-bit (f at the end!)
double precise = 3.14159265359; // 64-bit, default
// Symbols and strings
char grade = 'A'; // One character
String name = "Java Developer"; // Line (object!)
// Logical type
boolean isActive = true;
boolean hasErrors = false;
// Conclusion
System.out.println("Name: " + name);
System.out.println("Price: $" + price);
System.out.println("Active: " + isActive);
}
}Important nuances
String is an object, not a primitive. Strings in Java are immutable. Each concatenation operation creates a new string.
Automatic type conversion works from smaller to larger safely:
int x = 100;
long y = x; // OK, int fits into long
double z = y; // OK, long fits into doubleThe reverse direction requires explicit conversion:
double pi = 3.14;
int rounded = (int) pi; // Explicit conversion, fractional part is discardedOperators and control structures
Conditional operators
public class ControlFlow {
public static void main(String[] args) {
int score = 85;
// If-else
if (score >= 90) {
System.out.println("Excellent!");
} else if (score >= 70) {
System.out.println("Good");
} else if (score >= 50) {
System.out.println("Satisfactory");
} else {
System.out.println("Needs improvement");
}
// Switch (modern Java 14+ syntax)
String day = "Monday";
String mood = switch (day) {
case "Monday" -> "Beginning of the week";
case "Friday" -> "It's almost the weekend!";
case "Saturday", "Sunday" -> "Weekend!";
default -> "Ordinary day";
};
System.out.println(mood);
// Ternary operator
String result = score >= 50 ? "Passed" : "Fail";
}
}Cycles
public class Loops {
public static void main(String[] args) {
// For - when we know the number of iterations
for (int i = 0; i < 5; i++) {
System.out.println("Iteration: " + i);
}
// While - while the condition is true
int count = 0;
while (count < 3) {
System.out.println("Count: " + count);
count++;
}
// Do-while - will be executed at least once
int num = 10;
do {
System.out.println("Number: " + num);
num--;
} while (num > 5);
// Enhanced for (for collections and arrays)
int[] numbers = {1, 2, 3, 4, 5};
for (int n : numbers) {
System.out.println(n);
}
}
}Arrays and collections
Arrays in Java have a fixed size:
public class ArraysExample {
public static void main(String[] args) {
// Declaration and initialization
int[] numbers = new int[5]; // Array of 5 elements
numbers[0] = 10;
numbers[1] = 20;
// Immediately with values
String[] names = {"Alice", "Bob", "Charlie"};
// Two-dimensional array
int[][] matrix = {
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
};
// Iteration
for (int i = 0; i < names.length; i++) {
System.out.println(names[i]);
}
// Or simpler
for (String name : names) {
SystemFor dynamic structures, we use collections:
import java.util.*;
public class CollectionsExample {
public static void main(String[] args) {
// ArrayList - dynamic array
List<String> cities = new ArrayList<>();
cities.add("Moscow");
cities.add("St. Petersburg");
cities.add("Kazan");
cities.remove("Kazan");
System.out.println("Size: " + cities.size());
System.out.println("First: " + cities.get(0));
// HashMap - key-value
Map<String, Integer> ages = new HashMap<>();
ages.put("Alice", 25);
ages.put("Bob", 30);
ages.put("Charlie", 28);
System.out.println("Bob's age: " + ages.get("Bob"));
// HashMap Iteration
for (Map.Entry<String, Integer> entry : ages.entrySet()) {
System.out.println(entry.getKey() + ": " + entry.getValue());
}
// HashSet - unique elements
Set<Integer> uniqueNumbers = new HashSet<>();
uniqueNumbers.add(1);
uniqueNumbers.add(2);
uniqueNumbers.add(2); // Duplicate, will not be added
System.out.println("Set Size: " + uniqueNumbers.size()); // 2
}
}Object-oriented programming
Java is a pure OOP language. Everything is an object (except for primitives).
// Class definition
public class User {
// Fields (properties)
private String name;
private int age;
private String email;
// Designer
public User(String name, int age, String email) {
this.name = name;
this.age = age;
this.email = email;
}
// Getters and setters
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
// Methods
public void displayInfo() {
System.out.println("Name: " + name);
System.out.println("Age: " + age);
System.out.println("Email: " + email);
}
public boolean isAdult() {
return age >= 18;
}
}
// Use
public class Main {
public static void main(String[] args) {
User user = new User("Alexey", 25, "alex@example.com");
user.displayInfo();
if (user.isAdult()) {
System.out.println(user.getName() + " adult");
}
}
}Java is not just a language, it is a whole ecosystem.
Start small, write code every day, take courses in Codice and join us to our friendly community of developers in Telegram channel. After three months of regular practice, you will be confident in writing in Java, and after six months you will be able to apply for a position of a junior developer. Good luck in your studies!
