Introduction to java programming

  • Java is a programming language created by James Gosling from Sun Microsystems (Sun) in 1991. The target of Java is to write a program once and then run this program on multiple operating systems.
  • Java is a programming language and a platform.Java is a high level, robust, secured and object-oriented programming language.
  • Platform: Any hardware or software environment in which a program runs, is known as a platform. Since Java has its own runtime environment (JRE) and API, it is called platform.
  • Java is defined by a specification and consists of a programming language, a compiler, core libraries and a runtime (Java virtual machine) The Java runtime allows software developers to write program code in other languages than the Java programming language which still runs on the Java virtual machine.

The Java compiler

  • When you program for the Java platform, you write source code in .java files and then compile them.
  • The compiler checks your code against the languageā€™s syntax rules, then writes out bytecode in .class files.
  • Bytecode is a set of instructions targeted to run on a Java virtual machine (JVM).
  • In adding this level of abstraction, the Java compiler differs from other language compilers, which write out instructions suitable for the CPU chipset the program will run on.

Your development environment

  • The JDK includes a set of command-line tools for compiling and running your Java code, including a complete copy of the JRE.
  • Although you can use these tools to develop your applications, most developers appreciate the additional functionality, task management, and visual interface of an IDE.
  • Eclipse is a popular open source IDE for Java development.
  • Eclipse handles basic tasks, such as code compilation and debugging, so that you can focus on writing and testing code.
  • In addition, you can use Eclipse to organize source code files into projects, compile and test those projects, and store project files in any number of source repositories.
  • You need an installed JDK to use Eclipse for Java development.
  • If you download one of the Eclipse bundles, it will come with the JDK already.

The Java language was designed with the following properties:

  • Platform independent: Java programs use the Java virtual machine as abstraction and do not access the operating system directly. This makes Java programs highly portable. A Java program (which is standard-compliant and follows certain rules) can run unmodified on all supported platforms, e.g., Windows or Linux.
  • Object-orientated programming language: Except the primitive data types, all elements in Java are objects.
  • Strongly-typed programming language: Java is strongly-typed, e.g., the types of the used variables must be pre-defined and conversion to other objects is relatively strict, e.g., must be done in most cases by the programmer.
  • Interpreted and compiled language: Java source code is transferred into the bytecode format which does not depend on the target platform. These bytecode instructions will be interpreted by the Java Virtual machine (JVM). The JVM contains a so called Hotspot-Compiler which translates performance critical bytecode instructions into native code instructions.
  • Automatic memory management: Java manages the memory allocation and de-allocation for creating new objects. The program does not have direct access to the memory. The so-called garbage collector automatically deletes objects to which no active pointer exists.

Java Example

class Simple
    public static void main(String args[]){
    System.out.println("Hello Java");


Hello Java

Types of Java Applications

There are mainly 4 types of applications that can be created using java programming:

  1. Standalone Application.
  2. Web Application.
  3. Enterprise Application.
  4. Mobile Application.

Standalone Application

  • Standalone applications are also known as desktop applications or window-based applications.
  • These are traditional software that we need to install on every machine.
  • Example of standalone applications are: Media player, antivirus etc.
  • AWT and Swing are used in java for creating standalone applications.

Web Application

  • An application that runs on the server side and creates dynamic page, is called web application. Currently, Servelet, JSP, Struts, Spring, Hibernate, JSF etc. technologies are used for creating web applications in java.

Enterprise Application

  • An application that is distributed in nature, such as banking applications etc. is called enterprise application.
  • It has the advantage of high level security, load balancing and clustering.
  • In java, EJB is used for creating enterprise applications.

Mobile Application

  • An application that is created for mobile devices. Currently Android and Java ME are used for creating mobile applications.

Java Platforms / Editions

There are 4 platforms or editions of Java:

  • Java SE (Java Standard Edition) - It is a java programming platform. It includes Java programming APIs such as java.lang,,, java.util, java.sql, java.math etc. It includes core topics like OOPs, String, Regex, Exception, Inner classes, Multithreading, I/O Stream, Networking, AWT, Swing, Reflection, Collection etc.
  • Java EE (Java Enterprise Edition) - It is an enterprise platform which is mainly used to develop web and enterprise applications. It is built on the top of Java SE platform. It includes topics like Servlet, JSP, Web Services, EJB, JPA etc.
  • Java ME (Java Micro Edition) - It is a micro platform which is mainly used to develop mobile applications.
  • JavaFx - It is used to develop rich internet applications. It uses light-weight user interface API.