Java 101 – Lesson 3 – Dissecting Hello World

This article is a continuation of articles in the series of Java 101. You will need to read lesson 1 and lesson 2 to completely understand this article (or blog post, or whatever you want to call it).  In lesson 2, we executed a piece of code, which printed “Hello World” on the command prompt (also called the console). The code looked something like this :

I added some extra text in there to  make it easy to understand what each line is doing. Notice that the extra text I added is in between /* and */ . Any text placed in between /* and */ is called a comment. Comments are pieces of information that are ignored by the compiler when it compiles and runs your code. They are meant to explain what your code is supposed to do, which is very helpful when the code is 3000 lines. As we move through the lessons, I will place comments in my example code so you should have an idea of how they are generally used.

The comments in the above code should explain pretty much everything about the Hello World application (or program). What you can do is copy this same structure for any program you write. And, just to be clear this is the structure :

Now that we know the basic structure of a Java program we will start learning some actual programming in the next lesson.

Published by Moazzam

Moazzam is a software developer working in the big apple. He has over a decade of experience in development. While most of his work involves developing web applications, he does development for Android and Windows Mobile in his spare time.

Join the Conversation

2 Comments

  1. Thank you again! I now understand / remember the basic structure of a program. Still trying to understand some of the errors I’m getting when writing basic code. One specific says ‘{‘ expected but as far as I can tell, the { is where it should be on the line it says it should be on. Hopefully I will find the answers in more of your ramblings. 🙂

Leave a comment

Your email address will not be published. Required fields are marked *