Everything you need to know to get started with Java

The language that truly propagated the era of "write once and run anywhere"

By Nicole Anklesaria Published Date
05 - Jan - 2016
| Last Updated
06 - Jan - 2016
Everything you need to know to get started with Java

Java is usually the first programming language most coders start out with since it is easy to understand and runs cross-platform. In fact Java is often referred to as ‘lingua franca’ or common language since such a vast number of developers are using it. Since just about everyone has either used it in the past or is still doing so, troubleshooting couldn’t be simpler – you’re guaranteed to find someone who can help. The developers of Java originally wanted to name it Oak. But the name was already trademarked by Oak Technologies, so a series of brainstorming sessions were held to come up with a dynamic and fun name that would attract coders of the next generation. The team came up with three options that were legally acceptable- Java, DNA and Silk. Finally Java was chosen.

Write Once Run Anywhere (WORA)

The term WORA is used to describe Java which means write once run anywhere. Once compiled the intermittent JVM or Java Virtual Machine takes compiled byte code and converts it into machine code which is understood by the machine. So once compiled your Java code can be run on any system irrespective of the underlying hardware or operating system. This feature of portability is what makes Java most attractive to programmers. Java derives a lot of its syntax and features from C++ but adds a lot of its own capabilities in the process.

Java is used to develop enterprise-wide applications, web applications, games and now mobile applications. In the mobile age of today Java is more relevant than ever. Android programming is largely done using Java. In fact the whole Oracle v/s Google lawsuit was because Oracle claimed Google infringed on their Java APIs to develop the Android operating system and APIs.

James Gosling

Java Editions

There are four editions of Java that target different application environments. The Java APIs are segmented to belong to one of the editions.

  • Java Card for Smart Cards
  • Java Platform, Micro Edition (ME) for environments with limited resources such as mobiles.
  • Java Platform, Standard Edition (SE) for workstation environments
  • Java Platform, Enterprise Edition (EE) for large distributed enterprises or Internet environments.

There are also a number of lightweight languages built on top of Java that can use the JVM eg Groovy (a dynamic language with features of Python, Perl, Smalltalk and Ruby), Clojure, Jython (a Python interpretor), JRuby (a Ruby interpreter). Each of these were built for their own dedicated purpose.

Java and Android

The Android operating system is built on the Linux kernel which is written in C. Android applications however are written in Java. Android does not use the Java Virtual Machine or JVM. It has its own Virtual Machine called the Dalvik Virtual Machine which does all the byte code conversions. The Java code is compiled into proprietary byte code and run on the Dalvik Virtual Machine. The Dalvik VM has a register based architecture unlike the Java VM which has uses a stack based architecture.

Oracle’s Java timeline

Oracle’s Java Timeline makes for interesting reading if you want to know the history of Java. It shows how Java has evolved and grown to become an integral part of our lives.

Hello world

The first line of code written in any programming language is a print statement of ‘Hello World’
So here it is in Java.
class FirstProgram{
public static void main(String args[]){
println(“Hello World!”);

Object Oriented Concepts

Conventional or procedural programming consists of executing a sequence of commands which input, output and manipulate data. Functions and subroutine allow the commands to be called repeatedly from different parts in the program. Object oriented programming consists of data and functions called methods which are bundled together into software ‘objects’ called ‘classes’. A Class is the blueprint from which objects are created. Object oriented programming makes it easier for programmers to structure and order the code. For example take a Racing game. Here ‘Car’ will be defined as an object having data members like make, model and speed. Car will also have methods like accelerate, turn left, turn right.
Class Car {
String make;
String model;
double speed;

public void accelerate(){
//code to accelerate 

public void turnLeft(){
//code to turn left
public void turnRight(){
//code to turn right

There can be two cars or there can be a hundred. Each will be called an instance of that object. Individual instances can be modified without affecting other parts of the program.

Core OOP Concepts 

I see lawyers coming!

Data Hiding/Abstraction
When data is grouped into classes/objects, programmers have the option of making data private to certain classes. Therefore the outer world will see only what is required to use the class without having access to any unnecessary sometimes private information.
Data Encapsulation 
Wrapping up logically related data and functions that operate on this data into bundles called classes.
Containers for logically related classes and interfaces bundled together.
When ones class can be based on another class, or reuse that implementation. It can also add its own features to that implementation. In our example above the class Car could have inherited certain features from another class (called its ‘super class’ or ‘base class’) called ‘Vehicle’.
Polymorphism is the ability for a method in Java to be able to do different things depending on the object it is acting upon. For example, a method called accelerate() in our Car class could have different implementations depending on the individual Car object or depending on the parameters provided to it.

Java Memory Management

One of the Java languages finest achievements is its memory management. Java has built in garbage collection. Developers can create objects without worrying about explicitly allocating and de-allocating memory.
The garbage collector automatically reclaims memory it deems not in use. This eliminates memory leaks and other memory related problems. Garbage collection maintains program integrity and is an important part of Java’s security strategy. It also stops heap fragmentation which occurs when memory is manually de-allocated freeing up a lot of intermittent space in between.

Learning tools
The tools available for learning and programming in java are excellent. Not to mention free. Sophisticated Integrated Development Environments (IDEs) such as NetBeans and Eclipse as well as web servers (TomCat), application servers (Glassfish, JBoss).
The Oracle docs have specified a set of highly useful tools to learn Java and Java-like languages depending on both age and experience. Whether you are an experienced programmer or a complete novice there is something in there for you. Whether you are 5 years old or 80 they have an easy interface for you to begin with. 
Scratch: A simple programming interface with drag and drop features. This tool was built for kids between the ages of 5-15 with no programming experience.
Greenfoot: A 2D visual software with a built-in code editor to create games and simulations. Again, this is for starters with no prior programming experience, but aged 13 upwards.
Alice: A 3D educational tool for animations with a drag and drop interface. No programming experience required. No age limit either.
BlueJ: This is a slightly more sophisticated tool where users are expected to write their own code. It is not an overwhelming IDE like Eclipse or NetBeans and provides the bare basics to run a Java program. A little coding experience is required to use BlueJ. High school kids usually start with this.
NetBeans/ Eclipse: These are fully featured Java Integrated Development Environments used in educational as well as professional environments.

How Inheritance works

Documentation and Websites

The Oracle online java documentation has pretty much everything that you need to get started. All functions calls and classes are explained well.


MIT OpenCourseware has Java tutorials
Coursera has not only courses for Java but courses that will teach you the basics of design patterns/principles and algorithm development.


For doubts about code and questions about how best to tackle a particular obstacle StackOverflow is possibly the best quorum out there. They even have a section for Code Review where senior peers will review the code you have written and give you feedback here.

For tutorials on 15 other hot programming languages go here.