Skip to content

Commit 3e60650

Browse files
authored
Writing first Java class using IntelliJ
1 parent b66309f commit 3e60650

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

section3/HelloWorld/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Getting Started with Java in IntelliJ IDEA
2+
Welcome to our Java course! In this guide, we'll walk you through creating your first Java class using IntelliJ IDEA, a powerful integrated development environment (IDE) for Java development.
3+
### Prerequisites
4+
Before getting started, ensure that you have the following installed on your system:
5+
- IntelliJ IDEA (Community or Ultimate edition) https://www.jetbrains.com/idea/download/?section=windows
6+
- Java Development Kit (JDK) installed on your machine https://docs.aws.amazon.com/corretto/latest/corretto-21-ug/downloads-list.html
7+
### Steps to Create Your First Java Class
8+
1. #### Open IntelliJ IDEA : Launch IntelliJ IDEA on your system.
9+
2. #### Create a New Project :
10+
- Click on Create New Project on the welcome screen or go to File > New > Project.
11+
3. #### Set Up Your Project :
12+
- Enter a Project Name for your project (HelloWorld).
13+
- Choose a Project Location where you want to save your project files.
14+
- Select the Language as Java.
15+
- Build system as IntelliJ.
16+
- Add JDK as corretto-21 or click on New... and locate your JDK installation directory.
17+
- Click on Create to create the project.
18+
4. #### Create a Java Class :
19+
- In the Project tool window (usually located on the left-hand side), right-click on the src folder.
20+
- Go to New > Java Class.
21+
- Enter a name for your class in the Name field (e.g., HelloWorld).
22+
- Optionally, you can specify a Package for your class. If you're just starting out, you can leave it as the default package.
23+
- Click OK to create the class.
24+
5. #### Write Your First Java Code :
25+
- IntelliJ IDEA will create a Java class file with a template for you.
26+
- You can start writing your Java code inside the class.
27+
```java
28+
public class HelloWorld {
29+
30+
public static void main(String[] args) {
31+
System.out.println("Hello Madan");
32+
}
33+
34+
}
35+
```
36+
37+
6. #### Run Your Java Program :
38+
- Click on the green Run icon next to the main method or right-click anywhere inside the main method and select Run 'HelloWorld.main()'.
39+
7. #### View Output :
40+
- You should see the output "Hello Madan" printed in the Run tool window at the bottom of the IntelliJ IDEA window.
41+
42+
Congratulations! You've successfully created and executed your first Java class using IntelliJ IDEA.

0 commit comments

Comments
 (0)