What is Java?
Java is a general purpose, high-performance, robust, object-oriented programming language. It is intended to allow developers to "write once, run anywhere" (WORA), which means, when compiled Java code can run on any platform that supports Java, without the need for recompilation.
History of Java
Java was created by a team led by James Gosling for Sun Microsystems. Their aim was to develop a new technology for programming next-generation smart applications. Java took 18 months to finish. Gosling's team presented their first demonstration of the language in the form of Star7, in 1992. Star7 was a personal digital assistant with a Graphical User Interface.
In 1994 Sun Microsystems shifted Java's focus to the Internet after failure to break into the television industry. The Internet was gaining a lot of popularity and momentum at that time, and Sun Microsystems saw the potential the Internet had.
Java 1.0a was released in 1994. The first official public release of Java, Java 1.0a2 was released in 1995. The first Java Development Kit (JDK), JDK 1.0 was released in 1996.
Evolution of Java
After the release of JDK 1.0, in 1996, there have been many advancements in the language. Java has evolved at an explosive pace. Java 1.1 was released soon after 1.0, this new version was made up of a lot of revolutionary changes. Many new libraries which refined the applet's ability to handle events were reconfigured.
Java 2 was the next major Java release, this marked the beginning of Java's modern age.
Since the release of JDK 1.0 Java has gone through a lot of changes. The Java Community Process (JCP) has been involved in the governing of Java's evolution, since J2SE 1.4. All changes made to the Java language are made under the supervision of the JCP.
Develop your first Java app
What you will need:
PC with a simple text editor such as Notepad. We do however recommend that you download Notepad++.
Before you begin coding your first Java app there are a few things you under take:
- Download and install the Java Development Kit (JDK).
- Setup environment variable paths
Download JDK
Visit Oracle's Java site. Check the option “Accept License Agreement”, and choose an appropriate version for your computer from the list.

After downloading the program, run it to install the JDK on your computer.
When downloading, take note of the path where the JDK is going to be located. We are going to use this later.
Once complete, we can use Command Prompt to test if our install was successful by using the following command: java -version. You should see the following:

The next step is to set up our environment variables. Open up file explorer, then right click computer then click properties.
Next, click Advanced System Settings, make sure that the Advanced Tab is selected.
Click Environment Variables.
In the Environment Variables Window, click on New, found under System Variables.
Name your new environment JAVA_HOME, the path will be the path to your JDK, for example: C:\Program Files\Java\jdk1.8.0_101. Click OK
Next, look for a variable named Path. Click edit, then add the following to the path text box ;%JAVA_HOME%/bin. Click OK.
To test to see if we are now ready to develop in Java, open a new Command Prompt window and type the following javac -version. You should see the following:

Congratulations you are now ready to write your first Java app.
Develop Hello World app
Open up your text editor (Notepad).
Type the following:
Save your file as HelloWorld.js. Ensure that you remember where you have saved the file. This is required for later.
Now let us break down the code:

Every Java program requires a main() method in order for it to run.
Now lets run our program:
First we need to compile our code. In order to do that we need to open up Command Prompt, then we need to navigate to the location where your file is stored.
Type the following command: javac HelloWorld.java. You should see the following:

If everything is fine , the Java compiler quits silently. After compiling, it generates the HelloWorld.class file file which is bytecode form of the HelloWorld.java.
Now if we type dir, we will see the following:

As you can see the HelloWorld.class has been generated as is located in the same location as your HelloWorld.java
Now that we have compiled our code, let's run it:
Type the following command: java HelloWorld

Our Java program displays Hello World in the console and then terminates.
There you have it. You have created your Java app!
Building Console Calculator
We are now going to build a console calculator that takes in two number and performs the mathematical operation required by the user.
Here is the code. Type this in your text editor and save the file as Calculator.java.
Now, let us break it down:
The first two lines of our code are imports, what they allow us to do is import external classes into our Calculator class. Our calculator class is then able to use the attributes and methods of those classes. The two classes we import, Scanner and InputMismatchException are very much important to for our calculator. The Scanner class allows user to capture user input from the console and the InputMismatchException catches any invalid user input and alerts the user of it, ie user enters a string value instead of an integer value.
We then see our class definition public class Calculator. Public indicates that this class is public, meaninig that any classes can access and utilise it's methods and attributes, provided they are not private. Class is an indication that this is a class and Calculator is the name of the class.
Next we get our main method, the method responsible for running our application. Every Java program requires a class that has a main method. Without it there is no program.
Now we divulge into the fun part, our core calculator logic. The first line of code in our main method is try. What is try and what is it used for? Well to explain what try is we need to look at concept called exceptions. An exception is a problem that occurs during the execution of a program, this problem can lead to abnormal behaviours in your application and it can even lead to your application crashing (that's no fun). Exceptions can be handled through the use of something we call a try catch block. A try catch block tries a piece of code, if all is well with it then it continues as normal, however if the code is tried and we run into an exception, the exception is caught an the appropriate action is taken, hence the name try catch.
To explain it using code let's take our try catch block
We first try the code - We create and object for our Scanner class, create variables to store our user input and then we proceed to ask the user to insert the numbers and operation for their calculation. To accept user input we user the Scanner class' nextLine method for strings and nextInt for integers. We then proceed to check which operation the user chose, by using the if statement. The if statement check to see if the operation method is equal to 1, if it is it proceeds to call the add method. As you can see we had to create an object for our calculator class for that our static main method can call our non static add method. Also we pass to values to the add method, these are the numbers the user enter previously. If operation is not 1 then it proceeds to the next else if. It checks to see if operation is equal 2 to if it is, it will exceute that code block, if not it moves on to the next else if. If the code has moved through all the else ifs and reaches the else block, it will then exceute what is in it, as all conditions before that was false. In our case the user will then be notified of their invalid choice. If no exceptions are caught during the execution of this block, the code will execute and then terminate as usual. However if the is an exception the catch block will be exceuted.
We have two catch blocks, one for catching input mismatches and another for catching other exceptions that may arise. The first catch block we pass InputMismatchException to the catch method, which will catch any input mismatches, for example user enters a string for one the numbers. It then displays the warning message to the user. The second catch block will catch any exceptions that might occur as we are unsure as to what other exceptions that can take place, so we user the general Exception class.
Next we have our operation methods
The add method takes in two numbers, adds the two numbers and then displays the result to the user.
The subtract method takes in two numbers, subtracts them and then displays the result to the user.
The divide method takes in two numbers, divides them and then displays the result to the user. If the second number is zero a message is displayed to the user indicating to the user that dividing a number by zero is not recommended.
The multiply method takes in two number, multiplies them and then displays the result to the user.
Now go forth and test your calculator
Expected result of running your calculator:

Present state of Java
Java is utilised in a large number of applications, both mobile and web. Android uses Java in it's make up and many Android applications are written using Java. Websites make use of Java Server Pages, a scripting language similar to PHP. Gaming consoles utilise Java to a certain extent. Java is also used in television sets.
At Zonketech we use Java in the development of Android mobile applications.
Future of Java
Although there are other languages that seem to be over taking Java, Java is still not going anywhere. Android's backbone is Java and with Android's popularity this means Java will utilised for years to come.
With advent of VR and AR this means Java may be used in ways never before thought possible.
Java is constantly evolving and aims to be developer friendly and evolutionary with each JDK release.