Java Development (13 Part Series)
1 Getting Back to Java: A Journey Through One of the Most Versatile Languages
2 How to Set Up Your Environment to Start Java Development
… 9 more parts…
3 IntelliJ IDEA on Ubuntu: Begin Your Journey into Java Development!
4 Your First Java Project in IntelliJ IDEA: Creating a “Hello World” in Java
5 Exploring Classes and the Main Method in Java
6 Exploring Class Organization with Packages in Java
7 Variables and Data Types in Java
8 Understanding float and double in Java
9 Types: char and boolean
10 Exploring Non-Primitive Types in Java: A Dive into Object-Oriented Programming
11 Understanding Strings and Arrays in Java
12 Exploring the for Loop in Java
13 Exploring While and DoWhile in Java: Master Loop Structures with Practical Examples
Ready to create your first Java program using IntelliJ IDEA? In this article, I’ll guide you through the amazing journey of setting up a new Java project and running your very first “Hello World” program. Let’s keep it simple and practical!
Step 1: Creating the Project
- On the welcome screen, click “New Project”.
- Under New Project, select Java.
- Under Name, enter Hello World or the name of your project.
- Give your project a name, and for the “Location” field, you can leave the default path:
~/IdeaProjects
. - If you’d like, you can create a GitHub repository to version your code by checking the box labeled “Create a GitHub repository“.
- In Build System, choose IntelliJ.
- In the JDK field, select version 17 (or the version of your JDK).
- Uncheck the “Add sample code” box to start the project from scratch.
- Click “Create”.
ongratulations! You’ve successfully created a new Java project.
Step 2: Creating Your First Java Class
-
Right-click the “src” folder, select “New”, and then “Java Class”.
-
A modal will appear where you can name your file, here “MyFirstClass“. Choose a name for the Class.
-
The basic structure of the class will be generated automatically.
Step 3: Writing the Code
Inside your new class, type “main” and hit Enter. IntelliJ IDEA will automatically create the main
method signature for you.
press enter
IntelliJ IDEA will automatically create the main
method signature for you.
Within the main
method, add the following code:
System.out.println("Hello World");
Enter fullscreen mode Exit fullscreen mode
Step 4: Running the Program
Now, just click the green play icon to run your program.
That’s it! Your first Java program is up and running, and you can start exploring the power of IntelliJ IDEA for Java development on Ubuntu.
Ready to continue your Java programming journey? This is just the first step. Soon, we’ll dive into more features of IntelliJ IDEA and take your development skills further! See you next time!
Java Development (13 Part Series)
1 Getting Back to Java: A Journey Through One of the Most Versatile Languages
2 How to Set Up Your Environment to Start Java Development
… 9 more parts…
3 IntelliJ IDEA on Ubuntu: Begin Your Journey into Java Development!
4 Your First Java Project in IntelliJ IDEA: Creating a “Hello World” in Java
5 Exploring Classes and the Main Method in Java
6 Exploring Class Organization with Packages in Java
7 Variables and Data Types in Java
8 Understanding float and double in Java
9 Types: char and boolean
10 Exploring Non-Primitive Types in Java: A Dive into Object-Oriented Programming
11 Understanding Strings and Arrays in Java
12 Exploring the for Loop in Java
13 Exploring While and DoWhile in Java: Master Loop Structures with Practical Examples
原文链接: Your First Java Project in IntelliJ IDEA: Creating a “Hello World” in Java
暂无评论内容