Java Programming Overview

18th October 2018 0 By Alin Bistrian
Before we start diving into the wonderful world of Object-Oriented Programming with Java it is nice to spend a few minutes and read a little bit about Java’s history.

 

Even if this is optional I recommend it because it will give you more confidence and it can give you a chance for a good first impression when you are at your new job and there will be a discussion about early days of Java’s existence.

 

What is Java

Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible. It is intended to let application developers write once, run anywhere (WORA), meaning that compiled Java code can run on all platforms that support Java without the need for recompilation.

 

Java applications are typically compiled to bytecode that can run on any Java Virtual Machine (JVM) regardless of computer architecture. As of 2016, Java is one of the most popular programming languages in use, particularly for client-server web applications, with a reported 9 million developers.

 

Java was originally developed by James Gosling at Sun Microsystems (which has since been acquired by Oracle Corporation) and released in 1995 as a core component of Sun Microsystems’ Java platform. The language derives much of its syntax from C and C++, but it has fewer low-level facilities than either of them.

 

History

James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. Java was originally designed for interactive television, but it was too advanced for the digital cable television industry at the time.

 

The language was initially called Oak after an oak tree that stood outside Gosling’s office. Later the project went by the name Green and was finally renamed Java, from Java CoffeeGosling designed Java with a C/C++-style syntax that system and application programmers would find familiar.

 

Sun Microsystems released the first public implementation as Java 1.0 in 1996. It promised “Write Once, Run Anywhere” (WORA), providing no-cost run-times on popular platforms. Fairly secure and featuring configurable security, it allowed network- and file-access restrictions.

 

Major web browsers soon incorporated the ability to run Java applets within web pages, and Java quickly became popular. The Java 1.0 compiler was re-written in Java by Arthur van Hoff to comply strictly with the Java 1.0 language specification.

 

With the advent of Java 2 (released initially as J2SE 1.2 in December 1998 – 1999), new versions had multiple configurations built for different types of platforms.

 

J2EE included technologies and APIs for enterprise applications typically run in server environments, while J2ME featured APIs optimized for mobile applications. The desktop version was renamed J2SE. In 2006, for marketing purposes, Sun renamed new J2 versions as Java EE, Java ME, and Java SE, respectively.

 

Fundamental Principales

There were five primary goals in the creation of the Java language:
  1. It must be                  – simple, object-oriented, and familiar
  2. It must be                  – robust and secure
  3. It must be                  – architecture-neutral and portable
  4. It must execute with  – high performance
  5. It must be                  – interpreted, threaded, and dynamic

 

Major Java versions and their release dates

  • JDK 1.0 (January 23, 1996)
  • JDK 1.1 (February 19, 1997)
  • J2SE 1.2 (December 8, 1998)
  • J2SE 1.3 (May 8, 2000)
  • J2SE 1.4 (February 6, 2002)
  • J2SE 5.0 (September 30, 2004)
  • Java SE 6 (December 11, 2006)
  • Java SE 7 (July 28, 2011)
  • Java SE 8 (March 18, 2014)
  • Java SE 9 (September 21, 2017)
  • Java SE 10 (March 20, 2018)
  • Java SE 11 (September 25, 2018)
Officially supported versions are Java 8 and 11

 

Automatic memory management

One of the ideas behind Java’s automatic memory management model is that programmers can be spared the burden of having to perform manual memory management.

Java uses an automatic garbage collector to manage memory in the object lifecycle. The programmer determines when objects are created, and the Java runtime is responsible for recovering the memory once objects are no longer in use.

Once no references to an object remain, the unreachable memory becomes eligible to be freed automatically by the garbage collector. Something similar to a memory leak may still occur if a programmer’s code holds a reference to an object that is no longer needed, typically when objects that are no longer needed are stored in containers that are still in use.

If methods for a nonexistent object are called, a “null pointer exception” is thrown.

Syntax

Here is how the famous “Hello, world!” program looks like in Java:

 

public class HelloWorldApp {
public static void main(String[] args) {
        System.out.println("Hello, world!"); //Prints   Hello, world!   to the console
    }
}

 

If you are new to programming this post should be enough for now. If you already have some experience with Java or other programming languages and you want to read more you can find the Wikipedia full article here:  https://en.wikipedia.org/wiki/Java_(programming_language)