Starting your journey in IT Applications Development doesn’t have to be scary. To get started, you need three main tools: Visual Studio Code (VS Code), the Extension Pack for Java, and the Java Development Kit (JDK).
Step 1: Install the "Brain" (Extension Pack for Java)
In VS Code, go to the Extensions view (Ctrl+Shift+X) and search for the Extension Pack for Java. This pack gives you syntax highlighting, which colors your code to make it readable, and adds "Run" buttons so you can test your code easily.
Step 2: Install the "Engine" (JDK)
Without the JDK, your computer won't understand the Java language. You can install it through VS Code by pressing Ctrl + Shift + P and typing "Java: Install New JDK". Once installed, remember to restart VS Code to activate it!
The Basics of a Java Program
Every Java program follows a few simple rules:
- Classes: All your code lives inside a "class".
- The Main Method: This is the starting point where your code begins to run.
- Printing: We use
System.out.println()to show text on the screen. - Semicolons: These are like "periods" at the end of a sentence; every statement needs one.
Your First Code
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
To run this, click the play button provided by the Extension Pack, or type javac HelloWorld.java followed by java HelloWorld in your terminal.