Where it begins…
The first step is you have to say that you can.
I can remember it vividly. The first time I wrote some Java code. Interning at a company back in Des Moines. After installing the Java Development Kit I created my first file. Then I compiled and ran it. From there I learned some more basics and was able to understand the code.
The writing of your first program is usually called Hello World. For obvious reasons we just put that output on the screen. We have to start somewhere so this is a good first step. Enter this code into Eclipse. It should be in a file called HelloWorld.java.
Once you get it entered then you can run it and you should see output that says, “Hello World!”.
Okay, so it is not like stepping into the Matrix. Maybe more like one small step. If you are inclined to run this from the command line you would type “javac HelloWorld.java” first to compile it to a .class file. Then you could execute it from the command line by typing “java HelloWorld” and see the output. Most developers use IDEs but there are a few of the command line people out there.
As we first look at the code the “System.out.println” statement is just using the Java API to output our message. The main method is a special method in Java that can be used to run from the command line or simple programs. As you progress in Java most programs will not have a main method. Since Java is Object Oriented the code needs to be in a class. So we are creating a HelloWorld class. We will get more into objects later on.
The skill I use most of all is troubleshooting in my professional work. Occasionally I write some new code. More often though I am spending time trying to determine why something doesn’t work. So you have entered the code into your IDE and tried to run it with no luck. I taught Java at a community college once. I learned many different issues that I didn’t think were possible. Make sure your Java Development Kit is installed. Maybe you skipped a step along the way. Programming is a lot like a recipe. You have to do things in order or it will fail miserably.
Java development and programming, in general, are not forgiving. Compilers don’t assume that you mean to put a semicolon at the end of your line. Growing up in the United States and working with many international co-workers I realize how often we use expressions. Like the compiler, they have trouble understanding what I am trying to say. So make sure you have the semicolon at the end of the line. The compiler is not going to give you leeway here. Although the IDE will usually point this out. Make sure to use the curly braces properly too. This helps Java set scope and know where a method ends. If you do get an exception always remember to use Google to help find the answer.
Originally posted on MyITCareerCoach.com