Index – Java

What is Java?

Java is an object-oriented programming language developed by Sun Microsystems in 1995, which was later acquired by Oracle. It is now a full platform with lots of standard APIs, open source APIs, tools, a huge developer community, and is used to build the most trusted enterprise solutions by big and small companies alike. Android application development is done fully with Java and its ecosystem. To know more about Java, read this and this.

Object-oriented Programming

JAVA is one of the object-oriented programming languages, unlike C and FORTRAN which are procedural languages. The object-oriented concept of programming makes it much more efficient than procedural languages. Basically, object orientation breaks the program into parts, which is decided by the programmer. Then the complete program is stored in the permanent memory, and when it is executed, only that part is brought to dynamic memory which is called by the programmer. Each such part is called a class and when it is called in the dynamic memory, it is called an object.

Java Editions

The latest version is Java 11, which was released in 2018 with various improvements over the previous version, Java 10. But for all intents and purposes, we will use Java 8 in this wiki for all tutorials.

Java is also divided into several “Editions” :

  • SE – Standard Edition – for desktop and standalone server applications
  • EE – Enterprise Edition – for developing and executing Java components that run embedded in a Java server
  • ME – Micro Edition – for developing and executing Java applications on mobile phones and embedded devices

Installation : JDK or JRE?

Download the latest Java binaries from the official website. Here you may be faced with a question: which one should I download, JDK or JRE? JRE stands for Java Runtime Environment, which is the platform dependent Java Virtual Machine to run Java code. JDK stands for Java Development Kit, which consists of most of the development tools, most importantly the compiler javac, and also the JRE. So, for an average user JRE would be sufficient, but for Java development, we need to download the JDK.

Platform specific installation instructions


  • Download the relevant .msi file (x86 / i586 for 32bits, x64 for 64bits)
  • Run the .msi file. Its a self extracting executable file which will install Java in your system!


Download the relevant tar.gz file for your system and install :

tar zxvf jdk-8uversion-linux-x64.tar.gz

RPM based Linux platforms download the relevant .rpm file and install :

rpm -ivh jdk-8uversion-linux-x64.rpm

Users have the choice to install an open source version of Java, OpenJDK or the Oracle JDK. While OpenJDK is in active development and in sync with Oracle JDK, they just differ in licensing stuff. However few developers complain of the stability of Open JDK.

Instructions for Ubuntu :

Open JDK installation :

sudo apt-get install openjdk-8-jdk

Oracle JDK installation :

sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer


  • Either download Mac OSX .dmg executable from Oracle Downloads
  • Or use Homebrew to install :
brew tap caskroom/cask brew install brew-cask brew cask install java

Verify Installation

Verify Java has been properly installed in your system by opening Command Prompt (Windows) / Windows Powershell / Terminal (Mac OS and *Unix) and checking the versions of Java runtime and compiler :

$ java -version java version "1.8.0_66" Java(TM) SE Runtime Environment (build 1.8.0_66-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode) $ javac -version javac 1.8.0_66

Tip : If you get an error such as “Command Not Found” on either java or javac or both, dont panic, its just your system PATH is not properly set. For Windows, see this StackOverflow answer or this article on how to do it. Also there are guides for Ubuntu and Mac as well. If you still can’t figure it out, dont worry, just ask us in our Gitter room!


After finishing the installation, we can begin to understand the nitty gritty of the Java ecosystem. Java is an interpreted and compiled language, that is, the code we write gets compiled to bytecode and interpreted to run. We write the code in .java files, Java compiles them into bytecode which is run on a Java Virtual Machine or JVM for execution. The bytecode typically has a .class extension.

Java is a pretty secure language as it doesn’t let your program run directly on the machine. Instead, your program runs on a virtual machine called the JVM (Java Virtual Machine). This virtual machine exposes several APIs for low-level machine interactions you can make, but other than that, you cannot play with machine instructions explicitly. This adds a huge bonus of security.

Also, once your bytecode is compiled it can run on any Java VM. This Virtual Machine is machine dependent, i.e it has different implementations for Windows, Linux and Mac. But your program is guaranteed to run in any system thanks to this VM. This philosophy is called “Write Once, Run Anywhere”.

JVM Core Responsibilities

  1. Coding & interpreting bytecode
  2. Security
  3. Automatic Memory Management
  4. jvm => Platform Dependent
  5. Bytecode =-> Platform Independent

Hello World!

Let’s write a sample Hello World application. Open any editor / IDE of choice and create a file

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

N.B. Keep in mind that in Java the file name should be the exact same name of the public class in order to compile!

Now open the terminal / Command Prompt. Change your current directory in the terminal / Command Prompt to the directory where your file is located. And compile the file :

$ javac

If your program compiled successfully, you can see the bytecode file or class file HelloWorld.class generated by the java compiler javac in the same folder.

Now run the file using java command! Please note that the .class extension is not used while running the class file.

$ java HelloWorld Hello, World

Congrats! Your first Java program has run successfully. Here we are just printing a string passing it to the API System.out.println. We will cover all the concepts in the code, but you are welcome to take a closer look! If you have any doubt or need additional help, feel free to contact us anytime in our Gitter Chatroom!


Java is heavily documented, as it supports huge amounts of API’s. If you are using any major IDE such as Eclipse or IntelliJ IDEA, you would find the Java Documentation included within.

Also, here is a list of free IDEs for Java coding:

Video Tutorial

This article needs improvement. You can help improve this article. You can also write similar articles and help the community.

1 Comment on “Index – Java