Checking lesson access...
Introduction to Java
Find out what kind of language Java is, where it is used, and how the language, the JDK and the JVM relate to each other.
You are viewing a free preview lesson.
Lesson Overview
Java is a high-level, general-purpose, statically typed, and class-based programming language with strong support for object-oriented programming. It is used to build everything from small command-line programs to backend services, banking platforms, e-commerce applications, and large distributed systems.
Before investing months in a language, it is worth knowing what kind of language it is, where it is used and what it will ask of you. In this lesson, we look at what those words mean in practice, where Java came from, why backend teams choose it, and which parts of it beginners find hard.
Learning Objectives
After completing this lesson, you will be able to:
- Explain what type of programming language Java is
- Identify important characteristics of Java
- Understand where Java is used
- Explain the relationship between the Java language, JDK, and JVM at a basic level
- Understand the importance of Java in backend development
- Describe some benefits and trade-offs of learning Java
What Is Java?
Java is a high-level, general-purpose, statically typed and class-based language, with strong support for object-oriented programming. Lesson 1.02 explained "high-level"; this section explains the other three. A simple Java program:
public class Main {
public static void main(String[] args) {
System.out.println("Hello Java");
}
}
Output:
Hello Java
You do not need to understand every part of this code yet; in the following lessons, we will learn Java syntax, methods, classes, and objects step by step.
General-Purpose Language
A general-purpose language is not designed for only one specific type of task. Java is used to build command-line applications, backend services and REST APIs, web applications, financial systems, e-commerce platforms, data processing applications and distributed systems.
Statically Typed Language
Java is a statically typed language: the types of variables and expressions are checked at compile time. Here, age is an integer and name is a String:
int age = 25;
String name = "Sakib";
The following code is not valid, and the compiler can detect that a text value is being assigned to an int variable:
int age = "twenty-five";
Static typing allows many types of errors to be detected before the program runs. It can also make refactoring and maintenance easier in large codebases.
Class-Based and Object-Oriented Programming
A large part of Java code is structured using classes:
public class Student {
String name;
int age;
}
Here, Student is a class that represents the structure of student-related data. In the same way, Java code can model a Course, a Product, an Order, a BankAccount or a Payment. From module 3 on, we start with classes and objects and then cover encapsulation, composition, inheritance, abstraction, interfaces and polymorphism.
The goal of this course is not only to learn Java syntax, but also to learn how to design maintainable object-oriented software using Java.
A Brief History of Java
Java development began in the early 1990s at Sun Microsystems through James Gosling and his team. The language was originally called Oak; it was later renamed Java and was publicly released in 1995. Its goals included portable software that runs on different platforms, a managed runtime environment, and less of the low-level complexity of C and C++. Over time, Java became widely used in enterprise and server-side software development.
Java Language, JDK, and JVM
When understanding the Java ecosystem, it is useful to distinguish between three terms:
Java Language
The syntax and programming rules developers use to write source code.
JDK
JDK — Java Development Kit is the toolset needed to develop Java applications. It includes the compiler and other development-related tools.
JVM
JVM — Java Virtual Machine executes compiled Java bytecode. In the previous lesson, we followed the flow from source code through the compiler (part of the JDK) to bytecode and the JVM. This architecture is the foundation of Java's portability and managed runtime model.
OpenJDK
OpenJDK is the open-source implementation of the Java platform. Different vendors in the Java ecosystem may provide JDK distributions based on OpenJDK, but as a beginner, vendor differences are not important yet. The main point is:
A compatible JDK is required to develop Java applications, and it also includes what you need to run them.
Important Characteristics of Java
Several characteristics of Java have made it suitable for production software development.
Readable and Explicit
Java syntax is relatively explicit:
int price = 500;
int quantity = 2;
int total = price * quantity;
By reading the code, it is easy to understand the variable types and the calculation. This explicitness can be useful in large teams and large codebases. The trade-off is that Java can be more verbose than some other languages.
Platform Portability
The Java compiler generates bytecode, and a compatible JVM can execute that bytecode. Because of this model, the same compiled Java application may be able to run on different operating systems. However, if an application uses native libraries or operating-system-specific dependencies, portability may be limited.
Strong Type System
Static typing, described above, pays off beyond catching errors. Every value in int quantity = 10;, String productName = "Keyboard"; and boolean available = true; has a declared type, and that information helps developers understand code, lets the IDE offer better help, makes refactoring safer and method contracts clearer, and helps keep large codebases maintainable.
Automatic Memory Management
The JVM manages memory for Java applications, so developers generally do not need to manually allocate and free memory. The JVM uses Garbage Collection to reclaim memory from unused objects, which reduces the complexity of low-level memory management.
However, automatic memory management does not mean that developers never need to think about memory. In production applications, allocation, object lifetime, and memory usage can still be important.
Standard Library
Java provides a rich standard library: built-in APIs for string processing, collections, file handling, date and time, networking, concurrency, input/output and security. For example:
String name = "Java";
System.out.println(name.length());
Output:
4
Here, String and length() are part of Java's standard library.
Mature Ecosystem
A large production ecosystem of frameworks, libraries, tools and community has grown around Java over many years. Popular technologies include Spring Boot, Hibernate, Maven, Gradle, JUnit, Mockito, Jackson and the Kafka client. They make application development, persistence, testing, build automation and integration easier. This is why it is important to understand core Java well before learning frameworks.
Concurrency Support
Java provides built-in language and library support for concurrent programming. Backend applications may need to handle many requests or background tasks at the same time.
Concurrency is an advanced topic, so you do not need to understand its implementation at this stage. However, it is an important concept in production Java development.
Where Is Java Used?
Java is used in many types of software systems.
Backend and API Development
Java is widely used for building server-side applications. A backend application typically receives HTTP requests, executes business logic, works with databases, handles authentication and authorization, communicates with other services, and produces API responses. Spring Boot is a widely used framework for Java backend development.
Enterprise and Financial Systems
Java has been used in enterprise software for many years: banking, payment processing, insurance, telecom, e-commerce, healthcare and large internal business systems. These types of applications often need to be maintained for a long time, where reliability, tooling, and backward compatibility are important.
Distributed Systems
Java can be used to build services that work together over a network, such as microservices, message consumers, background workers, event-driven services and data processing services. The Java ecosystem integrates well with technologies such as Kafka, gRPC, Spring, and various networking libraries.
Android and Desktop Applications
Java was an important language for Android development for many years. Although Kotlin is now prominent, Java is still relevant in the existing Android ecosystem.
Java can also be used to build desktop applications using Swing or JavaFX. However, the main focus of this course is the foundation of backend engineering.
Why Is Java Popular for Backend Development?
Java has remained popular in backend development for many years for several practical reasons.
Mature Ecosystem and Framework Support
The ecosystem described above is built on decades of production experience, with a large community behind it. Frameworks such as Spring Boot make it easier to build production backends: REST APIs, database integration, validation, authentication, messaging, configuration and monitoring. However, understanding framework abstractions requires a strong core Java foundation.
Performance
Modern JVMs can provide strong runtime performance for long-running server applications. However, application performance does not depend only on the programming language. Algorithms, data structures, database queries, network latency, memory allocation, concurrency design and application architecture often matter more.
Maintainability
Java's static typing and explicit structure help maintain large codebases:
public int calculateTotal(int price, int quantity) {
return price * quantity;
}
You will learn to write methods in module 2, but even now the first line tells you that two int inputs are required and an int result is returned. This kind of clear contract is valuable in large teams.
Tooling
The Java ecosystem has strong IDE support. IDEs such as IntelliJ IDEA help with code completion, showing compile-time errors as you type, refactoring, debugging, running tests and navigating dependencies. In large application development, tooling plays an important role in developer productivity and code safety.
Benefits of Learning Java
Learning Java builds a foundation not only in one language, but also in transferable software engineering concepts: types, variables, control flow, methods, classes and objects, interfaces, error handling, collections, generics and concurrency. This knowledge is also useful when learning other programming languages and backend technologies later. Java is also a practical foundation for production backend engineering.
Challenges of Learning Java
Java can be beginner-friendly, but it also has some challenges.
Syntax Can Be Relatively Verbose
Even simple tasks can sometimes require more syntax than in other languages: lesson 1.01 compared Java's System.out.println("Hello"); with Python's print("Hello"). Although Java's explicitness can increase verbosity in some cases, it can also help keep structure clear in large codebases.
Many New Terms Appear at the Beginning
In the first program of this lesson, a beginner sees many unfamiliar terms at once, such as public, class, static, void, and String. You do not need to memorize these immediately. The course will introduce them step by step in the correct sequence.
A Strong Foundation Is Needed Before Frameworks
If you start directly with Spring Boot without understanding Java syntax and OOP, the code may work, but it can be difficult to understand the underlying behavior. In particular, concepts such as object creation, interfaces, exceptions, generics, dependencies, and method invocation are important for understanding framework abstractions. This is why we will first build a strong Java and OOP foundation.
Java and JavaScript Are Not the Same
Despite the similarity in their names, Java and JavaScript are two different programming languages. Java is generally more associated with the JVM ecosystem and backend or enterprise development. JavaScript is the primary language for browser-based frontend development and is also used for backend development through Node.js. Their runtimes, type systems, ecosystems, and execution models are different.
Practice Exercise 1: Identify Java Characteristics
Solutions: lesson 1.22.
Write which Java characteristic is most closely related to each description below.
- Variable types are checked at compile time.
- The JVM can reclaim memory from unused objects.
- Software can be modeled using classes and objects.
- Built-in APIs are available for common tasks.
- Compiled Java code can run on different platforms using compatible JVMs.
Possible answers:
- Static typing
- Automatic memory management
- Object-oriented programming
- Standard library
- Platform portability
Practice Exercise 2: Where Can Java Be Used?
For any three of the following systems, briefly describe what kind of backend responsibilities Java could handle:
- Banking system
- Learning platform
- E-commerce application
- Food delivery application
- Payment service
Practice Exercise 3: Observe the Code
Look at the following code:
public class Product {
String name;
int price;
}
Answer:
- What is the name of the class?
- How many fields are there?
- What are the names of the fields?
- Which field stores text?
- Which field stores an integer?
Knowledge Check
Question 1
What type of programming language is Java?
Question 2
What does statically typed language mean?
Question 3
What does it mean that Java is class-based?
Question 4
What are the roles of the JDK and JVM?
Question 5
What are three reasons Java is popular for backend development?
Question 6
What does automatic memory management mean?
Question 7
Are Java and JavaScript the same language?
Knowledge Check Answers
Answer 1
Java is a high-level, general-purpose, statically typed, and class-based programming language with strong support for object-oriented programming.
Answer 2
In a statically typed language, the types of variables and expressions are checked at compile time.
Answer 3
Classes are important building blocks for structuring Java applications. Classes can be used to organize data and behavior.
Answer 4
The JDK provides the tools needed to develop Java applications. The JVM executes compiled Java bytecode.
Answer 5
Java's mature ecosystem, static type system, strong framework support, runtime performance, and tooling are important reasons for its popularity in backend development.
Answer 6
Automatic memory management means that the JVM can reclaim memory from unused objects, so developers generally do not need to manually free memory.
Answer 7
No. Java and JavaScript are two different programming languages.
Lesson Summary
- Java is a high-level, general-purpose, statically typed, and class-based language with strong support for object-oriented programming.
- Static typing lets the compiler detect many errors, such as assigning text to an
intvariable, before the program runs. - Java was created at Sun Microsystems by James Gosling and his team and publicly released in 1995, with portability as a central goal.
- The JDK provides the tools to develop Java applications, and the JVM executes compiled bytecode. OpenJDK is the open-source implementation of the Java platform.
- Important characteristics include readable code, platform portability, a strong type system, automatic memory management, a rich standard library, a mature ecosystem, and concurrency support.
- Java is widely used for backend services, enterprise and financial systems, and distributed systems.
- Java can be verbose, and beginners meet many new terms early, so this course builds a strong Java and OOP foundation before frameworks. Java and JavaScript are two different languages.
Think first
Coming soonCheckpoint questions that ask you to commit to an answer before the lesson shows it.