Java Full Course for free ☕
What You Will Learn
- How to download and install Java Development Kit (JDK) and an Integrated Development Environment (IDE) like IntelliJ
- How to create a new Java project and write your first Java program
- How to use basic data types such as integers, doubles, and booleans in Java
Key Concepts
Java Development Kit (JDK) is a software package that contains a compiler, which converts your written code into bytecode that can run on a machine. An Integrated Development Environment (IDE) is a workspace where you can write, compile, and run your code. Variables are reusable containers for values, and they can be either primitive (like integers and doubles) or reference (like strings). Data types determine the type of value a variable can hold, such as whole numbers (integers) or numbers with decimal portions (doubles).
Code Examples
public static void main(String[] args) {
System.out.println("I like pizza");
}
This code defines a main method, which is the entry point of a Java program, and prints “I like pizza” to the console.
int age = 21;
System.out.println(age);
This code declares an integer variable age and assigns it the value 21, then prints the value to the console.
double price = 19.99;
System.out.println(price);
This code declares a double variable price and assigns it the value 19.99, then prints the value to the console.
Lesson Summary
In this lesson, we started by downloading and installing the Java Development Kit (JDK) and an Integrated Development Environment (IDE) called IntelliJ. We then created a new Java project and wrote our first Java program, which printed a message to the console. We learned about variables and data types, including integers, doubles, and booleans. We saw how to declare and assign values to variables, and how to print their values to the console. We also learned about the main method, which is the entry point of a Java program. Additionally, we explored how to use the System.out.println() method to print text to the console.
Practice Exercise
Write a Java program that declares three variables: an integer year with the value 2025, a double price with the value 9.99, and a boolean isStudent with the value true. Print the values of these variables to the console using System.out.println().
What Is Next
In the next lesson, we will learn about more advanced data types in Java, such as strings and arrays, and how to use them in our programs. We will also explore how to use operators to perform calculations and make decisions in our code.