🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to Java Notes
Topic #3

Java Get Started


Get Started With Java

At W3Schools, you can try Java without installing anything.

Our Online Java Editor runs directly in your browser, and shows both the code and the result:

public class Main {
  public static void main(String[] args) {
    System.out.println("Hello World");
  }
}

This editor will be used in the entire tutorial to demonstrate the different aspects of Java.


Java Install

However, if you want to run Java on your own computer, follow the instructions below.

Some PCs might have Java already installed.

To check if you have Java installed on a Windows PC, search in the start bar for Java or type the following in Command Prompt (cmd.exe):

C:\Users\Your Name>java -version

If Java is installed, you will see something like this (depending on version):

<code>
java version "22.0.0" 2024-08-21 LTS<br/>
Java(TM) SE Runtime Environment 22.9 (build 22.0.0+13-LTS)<br/>
Java HotSpot(TM) 64-Bit Server VM 22.9 (build 22.0.0+13-LTS, mixed mode)</code>

If you do not have Java installed on your computer, you can download it at oracle.com.

Note: In this tutorial, we will write Java code in a text editor. However, it is possible to write Java in an Integrated Development Environment, such as IntelliJ IDEA, Netbeans or Eclipse, which are particularly useful when managing larger collections of Java files.


Java Quickstart

In Java, every application begins with a class name, and that class must match the filename.

Let's create our first Java file, called Main.java, which can be done in any text editor (like Notepad).

The file should contain a "Hello World" message, which is written with the following code:

public class Main {
  public static void main(String[] args) {
    System.out.println("Hello World");
  }
}

Don't worry if you don't understand the code above - we will discuss it in detail in later chapters. For now, focus on how to run the code above.

Save the code in Notepad as "Main.java". Open Command Prompt (cmd.exe), navigate to the directory where you saved your file, and type "javac Main.java":

C:\Users\Your Name>javac Main.java

This will compile your code. If there are no errors in the code, the command prompt will take you to the next line. Now, type "java Main" to run the file:

C:\Users\Your Name>java Main

The output should read:

<code class="notranslate">
Hello World
</code>

Congratulations! You have written and executed your first Java program.

Want to go beyond the notes?

Join CodingNow 2.0's Java course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Java Get Started – FAQs

Quick answers about learning Java Get Started in Java.

This free note from CodingNow 2.0 explains Java Get Started in Java — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Java topic on CodingNow 2.0, including Java Get Started, is 100% free with no signup required.
With focused practice, most students grasp Java Get Started in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now