Tuesday, September 13, 2016

Hello World

Hello fellow earthlings! Welcome to my new blog!

As you can tell from the title, my blog will be dedicated to exploring computer science concepts and conveying what I learn to you. We'll start of simple, which is always the best way to go.

To be honest, the title of this post is an inside joke in the computer science community. Why? Well, because the first program that any programmer writes is called "Hello World." The code is really simple:

public class HelloWorld
{
      public static void main (String [] args)
     {
          System.out.println("Hello World");
          //Prints "Hello World" to the terminal screen
     }
}

Or, at least, it is simple to me. Let's break it down:

public class HelloWorld --> This part of the code tells us what the class is. We won't need to go over it right now.

public static void main (String [] args) --> This part of the code is the main part, hence the keyword main. This is where we put the instructions for our code. Any objects that we create will be created in this section.

System.out.println("Hello World"); --> This line of code tells the computer to print on one line "Hello World" to the terminal. the ln part of println means that it automatically returns to the line below. This is particularly useful when you want elements on their own line, like for a list and such.

And there is the very first program that I ever learned! I'm not entirely sure why coders always start with this program, but it is a long-standing tradition.

No comments:

Post a Comment