Premium Only Content

#3 Write a First Code in JAVA | Skyhighes | Lecture 3
Ready to bring your Java dreams to life? Let's write your first code!
Here's your step-by-step guide:
1. Open a text editor or IDE:
Choose a comfortable environment for writing code. Popular options include:
Notepad++ (simple text editor)
Visual Studio Code (versatile with Java extensions)
IntelliJ IDEA (comprehensive Java IDE)
Eclipse (another popular Java IDE)
Image of different text editors and IDEs for JavaOpens in a new window
www.differencebetween.net
different text editors and IDEs for Java
2. Create a new file:
Name it HelloWorld.java (or any name you prefer, but keep the .java extension).
3. Type in the following code:
Java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Use code with caution. Learn more
4. Save the file.
5. Compile the code:
Open a command prompt or terminal.
Navigate to the directory where you saved the file.
Type javac HelloWorld.java and press Enter. This compiles your code into Java bytecode.
6. Run the code:
Type java HelloWorld and press Enter. This executes the bytecode and displays the output.
Congratulations! You've just written and run your first Java program!
Let's break down the code:
public class HelloWorld { ... }: This line defines a class named HelloWorld. Classes are like blueprints for creating objects in Java.
public static void main(String[] args) { ... }: This is the main method, the entry point of your program. It's where execution begins.
System.out.println("Hello, World!");: This line prints the message "Hello, World!" to the console.
Now that you've mastered the basics, explore more Java concepts and start building awesome projects!
-
1:14:53
Kim Iversen
3 hours agoBig Beautiful Bill Passes, What's In It For you?
17.7K27 -
1:07:27
Dr. Drew
6 hours agoHollywood's Conservative Rebels: Gary Sinise (Lt. Dan in Forrest Gump) & Siaka Massaquoi (Raided By FBI After Jan 6) – Ask Dr. Drew
22.3K -
3:04:39
sophiesnazz
3 hours ago $0.28 earnedTHE BEST VIBESSSS !socials
7.74K1 -
31:24
Michael Franzese
3 hours agoWould I Ever Run for President?
18K3 -
1:07:28
The Officer Tatum
3 hours agoLIVE: Big Beautiful Bill PASSES, Mexican Boxer ARRESTED By ICE + MORE | EP 137
22.7K12 -
38:24
Kimberly Guilfoyle
3 hours agoThe Trump Agenda Keeps on Winning! Latest News From Washington | Ep235
85.5K19 -
5:11:53
Donut Operator
8 hours agoCRIME/ FLAMETHROWERS / MP7 PURCHASE
108K19 -
2:17:12
Pop Culture Crisis
5 hours agoCharlize Theron on 'Call Her Daddy', Lauren Sanchez DRAGGED For Plastic Surgery | Ep. 870
36.3K9 -
1:18:54
The Quartering
6 hours agoWoke Women Dating (Special Guest), Stop Killing Games Initiative, Queer Children's Movie Tanks
123K32 -
1:17:25
The HotSeat
4 hours agoLibs Are Trying To Cancel Americas' Birthday?!?!
18.7K55