Today you will learn:
By the end, you will be able to run your first Java program.
Java is a popular programming language used for many types of applications.
Examples:
Why use Java?
To write and run Java programs, you need the Java Development Kit (JDK).
Steps:
An IDE (Integrated Development Environment) helps you write code more easily.
Popular IDEs:
Choose one and install it.
Every Java program follows a specific structure.
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Explanation:
public class HelloWorld → Defines the classmain → Entry point of the programSystem.out.println() → Prints text to the consoleWrite your first Java program:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Modify the program so that it prints:
Example:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("My name is Alex");
System.out.println("I am 16 years old");
System.out.println("My hobby is programming");
}
}