Java Introduction

In this tutorial you will learn about the Java Introduction and its application with practical example.

What is Java? – Introduction

Java is simply a general-purpose, high-performance object-oriented programming language developed by Sun Microsystems in 1991 by James Gosling. The first publicly available version of Java (Java 1.0) was released in 1995. Java is originally designed for the development of applications that can be embedded into everyday household consumer electronic appliances like TVs, Washing Machines, Mobile Phones, etc. The most striking feature of java is that it is a platform-neutral language, this means programs written in Java can be used on any computer running any operating system.

There are 2 basic types of Java applications –

  • Stand-alone applications – Stand-alone applications are simple java programs developed to perform a certain specific task on a stand-alone local computer.
  • Web applets – Web applets are small java programs developed for internet or network-based applications. Applet program run inside a web browser.

Characteristics of Java

Platform neutral language – Java programs are platform-neutral, this means programs written in Java can be used on any computer running any operating system, this is possible with the help of a java virtual machine.

Object-orientated programming language – In java programming language all the elements are objects except the primitive data types.

Strongly-typed programming language – Java is a strongly-typed programming language, which means we must define the type of the variable before using it, and conversion to other objects is relatively strict, it must be done in most cases explicitly by the programmer.

Compiled and Interpreted language – Usually, a computer programming language can be either compiled or interpreted, but in the case of Java both approaches are combined, thus it makes java a two-stage system. In the first stage, source code is transferred into the bytecode format which is platform neutral. These bytecode instructions will be interpreted by the Java Interpreter in the second stage.

Automatic memory management – Java programming language has in-built memory management capabilities, thus allocation and de-allocation for creating new objects are handled by java. Java program does not have direct access to the memory. There is a garbage collector that deletes objects automatically which is not active in the program.

The Java syntax is much similar to C++. Java is case sensitive, e.g. the variables my value will be treated as different variables.

Applications of Java

Java can be used for any of the following types of applications:

  • Real-time Systems
  • Embedded Systems
  • Simulation and Modelling
  • Object-Oriented Databases
  • Artificial Intelligence and Expert Systems
  • CIM/CAD/CAM Systems
  • Neural Networks and Parallel Programming
  • Decision Support Systems

Differences between Java and C

Java is a lot like C but the major difference between Java and C is that Java is an object-oriented language and has a mechanism to define classes and objects.

  • Java does not include the C unique statement keywords size and typedef.
  • Java does not contain the data types struct and union.
  • Java does not define the type modifiers keywords auto, extern, register, signed, and unsigned,
  • Java does not support an explicit pointer type.
  • Java does not have a preprocessor and therefore we cannot use # define, # include, and # ifdef statements.
  • Java requires that the functions with no arguments must be declared with empty parenthesis and not with the void keyword as done in C.
  • Java adds new operators such as an instance of and >>>.
  • Java adds labeled break and continue statements.
  • Java does not have a “goto” control structure.
  • Java adds many features required for object-oriented programming.

Differences Between Java and C++

Java is a true object-oriented language while C++ is basically C with object-oriented extension. However, some object-oriented features of C++ make the C++ code extremely difficult to follow and maintain.

Listed below are some major C++ features that were intentionally omitted from Java or significantly modified.

  • It does not support operator overloading.
  • This language does not have template classes as in C++.
  • Java does not support multiple inheritances of classes. This is accomplished using a new feature called “interface”.
  • Java does not support global variables. Every variable and method is declared within a class and forms part of that class.
  • Java doesn’t use pointers.
  • Java has replaced the destructor function with a finalize() function.
  • There are no header files in Java.

In this tutorial we have learn about the Java Introduction and its application with practical example. I hope you will like this tutorial.