Basic programming

Basic programming

To start off this tutorial series we are going to learn the very brief basics of programming, and in traditional programming nature we are going to create a hello world program using the Java language as a starting point.

Programs can run in various environments that they are written for, for instance, Linux can run C/C++ code, OS X can run Objective C/Swift code and Windows can run C#/VB code. The Java Runtime Environment may be installed on top of these operating systems among others essentially making Java programs cross-platform.

Java programs can run where the java env is installed.

There exists various other programming languages out there that one can use to run their code, to name a few PHP a server scripting language (many websites use this as a backend, in fact, this site is written in PHP), C/C++, C#, Python, Java think Android development, Ruby, JavaScript, Objective C/Swift think iOS development, Shell, Ruby, Assembly and Brainfuck (yes, this really exists) these are some of the programming languages out there.

A programming language is a formal constructed language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs to control the behavior of a machine or to express algorithms.

We are going to use Java for our hello world program, this involves three basic steps common in every programming language

  1. Type the program instructions in a text editor (later you will use IDE for this)
  2. Compile the program (IDE can help with compiling)
  3. Run the program

An IDE (Integrated Development Environment) is a software application which enables users to more easily write and debug programs specific to that programming language. Many IDEs provide features like syntax highlighting and code completion, which help the user to code more easily.

First things first we are going to set up our environment, we need a computer (for this tutorial i'm running Windows 8.1), any text editor of your choice download Scite, great starting point, and lastly you need to download and install the Java Development Kit click here for download page once at the download page click on your operating system "Windows x64" for 64bit or "Windows x86" for 32bit

Download JDK

Once installation completes the Java Platform JDK should be installed under C:\Program Files\Java\jdk1.8.0_25 if followed the basic installation, now we have to add the Environmental variable so we can execture our javac and java commands from the terminal/command prompt. To do this go to This PC (where you can view all your Hardrives and Folders) >> Right click any where that is not the Mapped the Harddrives of folders >> Click properties >> On the left last menu click on "Advanced system settings" >> A popup with system properties comes up OR simply Hold Windows Key and Pause/Break key ;-) 

System Properties

Once the System Properties window is open click on the Environment Variables button then look for the "Path" variable under System Variables select the variable and click on edit "NB: Do not delete the current information just place your cursor at the end of the line and paste the location of the JDK in your computer typically C:\Program Files\Java\jdk1.8.0_25\bin"  

Once that is complete open up command prompt (to open command prompt hit keys Windows Key+R then type cmd and hit enter, once command prompt is open type "javac -version" and then "java -version" if the setup went well you have successfully install javac and java and we may now write our simple hello world program :-)

Java Version is all setup

Next up Java Hello World program:

Open scite and type the following/copy and paste:

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

Save this file as on the Desktop with the Command shell still Change directories to the desktop with command "cd" i.e cd Desktop you can type "dir" to see what folders are in the directory. Next compile the file with command "javac"  this will create a HelloWorld.class file this is the language that the computer can understand. Then simply run "java HelloWorld" and boom you have just created your first java program :-)