codingstuff.io
ExploreTutorialsProblemsCS Subjects
Get Started
ExploreTutorialsProblemsCS Subjects
Get Started
codingstuff.io

Master the art of building software through interactive tutorials, real-world problems, and guided projects.

Pune, Maharashtra, India

codingstuffmail@gmail.com

Product

  • Explore
  • Tutorials
  • Problems
  • CS Subjects

Company

  • About
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

© 2026 codingstuff.io. All rights reserved.

Built with ❤️ for developers everywhere

/
/
All Tutorials
☕

Java Programming

2 / 65 topics
1Java Intro2Java Get Started3Java Syntax4Java Output5Java Comments6Java Variables7Java Data Types8Java Type Casting9Java Operators10Java Strings11Java Math12Java Booleans13Java If...Else14Java Switch15Java While Loop16Java For Loop17Java Break/Continue18Java Arrays
Tutorials/Java Programming/Java Get Started
☕Java Programming

Java Get Started

Updated 2026-05-12
15 min read

Java Get Started

Welcome to the second step in your journey to mastering Java! In this tutorial, we will cover the basics of setting up your development environment, writing a simple "Hello World" program, and understanding how to compile and run it. By the end of this guide, you'll be ready to start exploring more advanced concepts.

Introduction

Before diving into coding, you need to have Java installed on your computer along with an Integrated Development Environment (IDE). These tools will help you write, compile, and run your Java programs efficiently. Once set up, we'll create a simple "Hello World" program to get you started with the basics of Java syntax.

1. Installing Java

Java is available for Windows, macOS, and Linux. You can download it from the official Oracle website or use OpenJDK, which is an open-source implementation of the Java Platform.

Step-by-Step Installation Guide

For Windows:

  1. Download Java:

    • Visit Oracle's Java Downloads page and download the JDK for Windows.
  2. Install Java:

    • Run the downloaded installer.
    • Follow the on-screen instructions to complete the installation.
  3. Verify Installation:

    • Open Command Prompt.
    • Type java -version and press Enter.
    • You should see the installed version of Java displayed.

For macOS:

  1. Download Java:

    • Visit Oracle's Java Downloads page and download the JDK for macOS.
  2. Install Java:

    • Open the downloaded .dmg file.
    • Drag the Java icon to your Applications folder.
  3. Verify Installation:

    • Open Terminal.
    • Type java -version and press Enter.
    • You should see the installed version of Java displayed.

For Linux:

  1. Download Java:

    • Visit Oracle's Java Downloads page or use OpenJDK.
  2. Install Java:

    • Use your package manager to install OpenJDK. For example, on Ubuntu:
Bash
1
  1. Verify Installation:
    • Open Terminal.
    • Type java -version and press Enter.
    • You should see the installed version of Java displayed.

2. Setting Up an IDE

An Integrated Development Environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. Popular Java IDEs include IntelliJ IDEA, Eclipse, and NetBeans. We'll use IntelliJ IDEA as our example.

Step-by-Step Setup Guide

  1. Download IntelliJ IDEA:

    • Visit IntelliJ IDEA's official website and download the Community Edition (free) or Ultimate Edition (paid).
  2. Install IntelliJ IDEA:

    • Run the downloaded installer.
    • Follow the on-screen instructions to complete the installation.
  3. Create a New Project:

    • Open IntelliJ IDEA.
    • Select "New Project".
    • Choose "Java" and select your JDK version.
    • Click "Next", then "Finish".
  4. Write Your First Java Program:

    • In the project explorer, right-click on src -> New -> Java Class.
    • Name it Main.

3. Writing a Hello World Program

The traditional first program in any programming language is the "Hello World" program. It simply prints "Hello, World!" to the console.

Example Code: Main.java

Main.java
1public class Main {
2 public static void main(String[] args) {
3 System.out.println("Hello, World!");
4 }
5}

4. Compiling and Running Your Java Program

To run your Java program, you need to compile it first using the javac command and then execute it with the java command.

Step-by-Step Compilation and Execution Guide

  1. Open Terminal:

    • Navigate to the directory where your Main.java file is located.
  2. Compile the Program:

Bash
1javac Main.java
  • This will generate a Main.class file in the same directory.
  1. Run the Program:
Bash
1java Main

Expected Output

Output
Hello, World!

5. Practical Example

Let's create a more practical example that demonstrates basic Java concepts like variables and data types.

Example Code: Calculator.java

Calculator.java
1public class Calculator {
2 public static void main(String[] args) {
3 int num1 = 10;
4 int num2 = 5;
5
6 int sum = num1 + num2;
7 int difference = num1 - num2;
8 int product = num1 * num2;
9 double quotient = (double) num1 / num2;
10
11 System.out.println("Sum: " + sum);
12 System.out.println("Difference: " + difference);
13 System.out.println("Product: " + product);
14 System.out.println("Quotient: " + quotient);
15 }
16}

Expected Output

Output
Sum: 15
Difference: 5
Product: 50
Quotient: 2.0

Summary

  • Java Installation: Download and install Java from the official website or use OpenJDK.
  • IDE Setup: Use IntelliJ IDEA or any other Java IDE to create a new project.
  • Hello World Program: Write a simple program that prints "Hello, World!".
  • Compilation & Execution: Use javac to compile and java to run your Java programs.

What's Next?

Now that you have a basic understanding of setting up your environment and writing simple Java programs, it's time to dive deeper into Java syntax. In the next tutorial, we'll explore variables, data types, operators, and more. Stay tuned!


This completes our "Java Get Started" tutorial. You now have the foundation to start building more complex applications. Happy coding!


PreviousJava IntroNext Java Syntax

Recommended Gear

Java IntroJava Syntax