Difficulty: Beginner
Estimated Time: 10-15 minutes

Introduction to Programming - Part 1

Welcome! This is the first lesson in a series of introductory programming lessons, designed for people with little or no programming experience. It introduces fundamental concepts of creating computer programs.

In this lesson, you will create a simple program using the Java programming language. It will to display a message. By the end, it will also prompt the user for input.

Key Takeaways

  • What a compiler does.
  • The difference between keywords and identifiers.
  • How source code is constructed.
  • Using literal values, and variables.

Other Notes

Why Java™, some might ask? While it may not be the “easiest” language to start with, it has many excellent qualities to expose people to different programming paradigms. It is the language that helped me love programming back in 1995 when it was first publicly released.

So, without further ado, let's get started!

The End (of part 1)

If this is your first exposure to programming, there was a lot packed into this small lesson. I would encourage you to look over the concepts again to make sure you understand them. If not, look up the terms online. Wikipedia is a great resource for programming language vocabulary.

The next lesson will dive deeper into object types. We will cover "flow control" and create "methods" to do our bidding (other languages sometimes use the term "functions" instead of "methods").

Things start to get more interesting, really fast.

Introduction to Programming - Part 1

Step 1 of 3


Hello, World!

For this first lesson, you are going to write a traditional first program known as “Hello, World!”.

What, you ask, is “Hello, World!” anyhow? It simply prints “Hello, World!” to the screen. It isn't terribly exciting. But, it does give us a chance to talk about some important fundamentals.

To the right you should see an editor with a file named HelloWorld.java. This is the source code file. Type the code below into the editor (don't copy/paste…go through the exercise):

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


The computer cannot run the source code. We are using a high-level language, which the machine doesn't understand. Source code is for humans. Thankfully there is a translator that can take our code and turn it into something the computer understands. In this case, we use a compiler to translate our code into Java™ bytecode .

In some programming languages, an assembler takes what the compiler produces and further translates it to machine language. Machine language is directly executable. In Java, the Java Virtual Machine reads the bytecode and tells the machine what to execute.

Try It Out

Below the editor window there is a Terminal. It should say “Your Interactive Bash Terminal. A safe place to learn and execute commands.” Click in the terminal and type: javac HelloWorld.java (then press the enter key). javac is the Java compiler program.

If your source code is correct, it will create a file named HelloWorld.class—your bytecode. If you get errors, check the source code to make sure it matches the example. You can't continue if it doesn't compile!

Run it in the terminal by typing java HelloWorld to see what happens… You should see “Hello, World!” displayed.

Next, we'll discuss parts of the source code.