Core Java Tutorial

Introduction

  • Java is a pure object oriented programming language.
  • It was developed by ‘James Gosling’ at Sun Microsystems.
  • First version of Java was released in 1995.
  • Java provides the functionality of ‘write once, run anywhere’ (WORA).
  • The latest released version of Java standard edition is 1.8.

Functionalities of Java

Java provides important functionalities like:
  • Java provides a huge library.
  • Auto memory cleanup process i.e. automatic garbage collection.
  • Platform independent means it is portable on every operating system.
  • Code reusability which allows us to use the previous methods in next class.

Features of Java

Simple: Java is simple to understand because it eliminates lot of confusing properties like pointer, operator overloading, header files, goto statement etc.

Portable: When we compile Java code it generates byte-code that can be run on any operating system.

Object-Oriented: Java is a pure object-oriented programming language. It is totally based on object and class. It follows all basic concepts of  OOP e.g. inheritance, abstraction, encapsulation and polymorphism.

Secure: Java doesn’t support pointer, so without authorization we cannot access memory location. It also uses some cryptography for data security. JVM provides a virtual machine for running the Java programs.

Platform independent: It is one of the most important features of Java as it follows ‘write once and run anywhere’ function. After compilation Java code gets converted into byte-code and this code can run on any operating system.

Multithreaded: Java is a multithreaded programming language because it allows multiple tasks to be performed simultaneously to share the same memory.

Robust: Java uses strong memory management which is handled by automatic garbage collection. Exception handling provides the code checking mechanism.

High Performance: JIT compiler which interprets the Java code into byte-code will increase the performance of java.

Distributed: Java is basically designed for internet to have the distributed nature.

Dynamic: Java can carry lots of information on run time as it provides a link on different classes and objects dynamically.

Interpreted: Java compiler accepts the source code, converts it into byte-code and in second stage it converts into machine code with the help of interpreter.

JDCB RowSet: For sending the tabular format between remote components to distributed application JDBC RowSet is used as it provides direct access to the database.

Difference between Java and C++

JavaC++
Java does not support pointer.C++ supports the pointer concept.
Java doesn’t support structure and union.Structure and union are supported in C++.
Header file is not required. Header file is necessary in C++.
Java does not support operator overloading.It supports operator overloading.
Java uses finalize() method for memory cleanup.C++ uses destructor for memory destroying.
Java is pure object oriented language.C++ is only an extension of object oriented language.
Java does not support multiple inheritance.Multiple inheritance is supported by C++.
Java does not support global variable.C++ supports global variable.
Java uses instanceof operator for identifying an object.instanceof operator is not available in C++.
Write once, run anywhere (WORA).Write once, compile anywhere (WOCA)
Java has no goto statement.C++ has goto statement.
Java supports documentation comment.C++ does not support documentation comment.
Java doesn’t have any preprocessor.Preprocessor concept is available in C++, so it supports the #define or macros.
Java uses right shift operator (>>>) for inserting zeros at the top end.C++ uses right shift operator (>>).
Java supports the multithreading concept.C++ does not support any built in function for multithreading.