Java Tutorial


Introduction to Java programming


JAVA was developed by Sun Microsystems Inc in 1991, later acquired by Oracle Corporation. It was conceived by James Gosling and Patrick Naughton. It is a simple programming language.  Writing, compiling and debugging a program is easy in java.  It helps to create modular programs and reusable code.

Main Features of JAVA

Java is a platform independent language

To understand the meaning of platform independent, we must need to understand the meaning of platform first. A platform is a pre-existing environment in which a program runs, obeying its constraints, and making use of its facilities.
Lets back to the point. During compilation, the compiler converts java program to its byte code. This byte code can run on any platform such as Windows, Linux, Mac/OS etc. Which means a program that is compiled on windows can run on Linux and vice-versa. This is why java is known as platform independent language.

Java is an Object Oriented language

Object oriented programming is a way of organizing programs as collection of objects, each of which represents an instance of a class.
4 main concepts of Object Oriented programming are:
  1. Abstraction
  2. Encapsulation
  3. Inheritance
  4. Polymorphism

Simple

Java is considered as one of simple language because it does not have complex features like Operator overloading, Multiple inheritance, pointers and Explicit memory allocation.

Robust Language

Two main problems that cause program failures are memory management mistakes and mishandled runtime errors. Java handles both of them efficiently.
1) Memory management mistakes can be overcome by garbage collection.  Garbage collection is automatic de-allocation of objects which are no longer needed.
2) Mishandled runtime errors are resolved by Exception Handling procedures.

Secure

It provides a virtual firewall between the application and the computer.  Java codes are confined within Java Runtime Environment (JRE) thus it does not grant unauthorized access on the system resources.

Java is distributed

Using java programming language we can create distributed applications. RMI(Remote Method Invocation) and EJB(Enterprise Java Beans) are used for creating distributed applications in java. In simple words: The java programs can be distributed on more than one systems that are connected to each other using internet connection. Objects on one JVM (java virtual machine) can execute procedures on a remote JVM.

Multithreading

Java supports multithreading. It enables a program to perform several tasks simultaneously.

Portable

As discussed above, java code that is written on one machine can run on another machine. The platform independent byte code can be carried to any platform for execution that makes java code portable.