Provide Best Programming Tutorials

Hello World: How To Create Your First Java Program In Mac OS

Overview

This toturial will create your very first Java program under Mac OS.

Prerequest

  • JDK 1.8

  • Text Editor

Outline

  1. Writing a program and save it as HelloWorld.java

  2. Using javac command compile this java file to class file.

  3. Using java command to run the program and checkout the result

Component

HelloWorld.java

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

Using javac to compile this file to class file

Using java to run the program

Leave a Reply

Close Menu