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!
-
9:07
Silver Dragons
19 hours agoThis GOLD REVALUATION Will Change Everything
49.5K8 -
9:16
MudandMunitions
19 hours agoGriffin Armament 3x Prism Optic Unboxing and First Impressions! The Ultimate Tactical Upgrade
30.8K1 -
6:01
John Crump News
19 hours ago $0.70 earnedGOA vs. Philly: The Fight Starts!
25.9K3 -
3:03:35
TimcastIRL
13 hours agoTrump Just FIRED OVER 6,700 IRS Agents In PURGE, Democrats SOMEHOW Angry w/Chloe Cole | Timcast IRL
229K358 -
1:39:48
Kim Iversen
16 hours agoThe Measles Fear Hoax: How They’re Using an Outbreak to Smear RFK Jr.
152K124 -
1:18:19
Glenn Greenwald
15 hours agoRumble & Truth Social Sue Brazil’s Chief Censor Moraes in US Court; DC Establishment Melts Down Over Trump's Ukraine Policy | SYSTEM UPDATE #409
166K152 -
1:33:39
Redacted News
17 hours agoBREAKING! Europe goes NUCLEAR against Trump over pushing for PEACE in Ukraine | Redacted
215K290 -
1:00:43
The StoneZONE with Roger Stone
13 hours agoRoger Stone Destroys Mike Pence for Attacks on Trump | The StoneZONE
149K57 -
1:05:43
Flyover Conservatives
1 day agoFederal Reserve on the Chopping Block—Trump’s Boldest Move Yet! - Floyd Brown, Western Journal | FOC Show
83.4K16 -
2:50:40
Melonie Mac
19 hours agoGo Boom Live Ep 38!
82K7