Your first Java Application (Mac)

Installing and using Java on your mac is essential, but you’ll need to keep your beans (NetBeans)

Java is required. Do you know the basics of Java? This tutorial will help you write a simple “Hello, World!” application. Interested? Get stuck in!

Difficulty: Beginner | Easy | Normal | Challenging

Terminology

Character: A written character, usually associated with a letter of the alphabet

Console: A simple window for programming that can display output and (usually) process input

“Hello, World!”: A program or script that outputs “Hello World” to the console or has some other way of displaying the appropriate message

Integrated Development Environment (IDE): An application that provides a set of features that are used by software developers to create computer software

Java: A general-purpose programming language, designed by Sun Microsystems. Intended to allow developers to write once, run everywhere

NetBeans: An open source IDE for Java

String: A collection of Characters

Why Hello World!?

Simple tutorials usually begin with a “Hello world” tutorial. Those outside the programming community can feel that this is an unusual thing to choose, as it seems to have been picked simply because it is a simple word String (or just String) to print to the screen.

But why would anyone choose that particular String?

We can start at the beginning. There is a book about C programming which used a “Hello, World!” example — although this was actually lifted from a Programming in C: A Tutorial (1974) book.

The actual “Hello, World!” application that tutorials ask you to produce vary in sophistication and implementation, but the basic idea is that you print “Hello, World!” in some form.

With that settled, let us move on.

The resources

You will need to install Java. You can then download and install NetBeans. Whatever your platform, this is not too difficult a process.

The code

Every program in Java has the same main method, that is

public static void main(String [] args)

From there it only takes the knowledge of the function

System.out.println

to print our ideal String to the screen.

And from within NetBeans there is a relatively easy to see run button which looks a little like the following:

Image for post
Image for post

The video guide

You can watch the whole video from start to finish!

Conclusion…

Writing your first program in Java is not too much of a challenge. However, it is the first building block on a programming journey that many people have started.

The Twitter contact:

If you’ve got questions I’d love for you to get in touch with me. https://twitter.com/stevenpcurtis is a great channel for communication. Say HI!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store