BEHIND THE SCENES

The brain is like a muscle. When it is in use we feel very good. Understanding is joyous.
Carl Sagan

You have just created your first software application called Hello World. Perhaps you are not impressed. Let’s dig a little deeper and see if we can understand better what actually happened behind the scenes. Development can seem a bit mysterious at first when we don’t understand. Also, when you see the process outlined it can help with some troubleshooting you need to do.

Compile

When you compile your HelloWorld.java file the compiler interprets the code. Unless you have errors in your code it will create a HelloWorld.class file. This is the intermediate bytecode. The Java Development Kit or JDK is where this is done. The Java Virtual Machine or JVM can take the class file and execute it. Along with JVM, we use the Java Application Programming Interface or API. What is an API? This article sums it up nicely, “The API is a large collection of ready-made software components that provide many useful capabilities. It is grouped into libraries of related classes and interfaces; these libraries are known as packages.”

println

When you type System.out.println("Hello World"); you are using Java APIs. If you go to the JavaDoc link for the System class here you will see what it can do. Note that the out is the abbreviation for standard out. There is the standard error or “err” and standard “in” too. Of course, this is just a small part of the complete Java API. We can dive into many other things later but for now, we just want to touch on some basics that you have seen.

main

What is with the main method? If you want to have a stand-alone program in Java you need to have a main method defined. It can be defined in this manner: public static void main(String[] args). This post from StackOverflow explains it well. “When the Java interpreter executes an application (by being invoked upon the application’s controlling class), it starts by calling the class’s main method. The main method then calls all the other methods required to run your application.” So Java looks for that main method to kick things off. Also, as a bonus whenever you run into issues developing Google it! Chances are you will end up on StackOverflow.

If you have jumped into programming for the first time I just want to say keep going! Programming can be initially tough. Push through and learn more and you will find it rewarding. Also, as a technical career coach, I recommend everyone try coding out. It doesn’t mean you need to do it forever. The understanding you will gain will open many doors for you as you go through your career. Gain some exposure to it and you won’t regret it!

Originally posted on MyITCareerCoach.com