Overview About Java


Java Introduction

Java is an island in Indonessia. Java is a type of coffee, but Java is a most popular as a programming language. Java is object-oriented programming language making use of a methodology that is designed to have as few implementation dependencies as possible. It is a general-purpose programming language intended to let programmers write once, run anywhere,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 the underlying computer architecture. Java is strictly typed language,Java is also cross platform language i.e. it can run on the Unix,Linux,Window Operating systems. The syntax of Java is similar to C and C++, but has fewer low-level facilities than either of them and Java runtime provides dynamic runtime capabilities that are typically not available in traditional compiled languages. Now a days Java was one of the most popular programming languages in use,particularly for client & server web applications. Java software works anywhere for examples Televisions,Telephones,Watch,Supercomputers,Remote Controls and Microwave Ovens.

History Of Java

Java was developed by James Gosling at Sun Microsystems, USA IN 1991 as a part of the Green Project and released in 1995 as a core component of Sun Microsystems' Java platform.Initially the language was named Oak, of a tree James see out from his office window.Oak was renamed as Java in the spring of 1995.The original and reference implementation Java compilers, virtual machines, and class libraries were originally released by Sun Microsystems under proprietary licenses. As of May 2007, in compliance with the specifications of the Java Community Process, Sun Microsystems had relicensed most of its Java technologies under the GPL-2.0-only license.Oracle offers its own HotSpot Java Virtual Machine(JVM), however the official reference implementation is the OpenJDK JVM which is free open-source software and used by most developers and is the default JVM for almost all Linux distributions.

Java Features

Java is a simple language that can be learned easily even if you have just started programming. It was designed to be easy for the programmer to learn and understand.
Java supports the object oriented approach to develop programs.It supports various features of an object oriented lanuage, such as Inheritance , Polymorphism , Abstractin , Encapsulation and to implement the object oriented language, the entire code of the program must be written within a class.
Java is used to develop application that can be distributed among various computers on the internet network and designed for the distributed environment of the internet because it supports the various protocols,like as Internet Protocol(IP) and Transmission Control Protocol(TCP).
Java is most portable language in the sense of two ways.First is it is a platform independent i.e. run on any machine.
Java is a simple language that can be learned easily even if you have just started programming. It was designed to be easy for the programmer to learn and understand.

Difference Between Java and C Languages

Main difference between Java and C is that Java is an object-oriented language and has all procedure to define classes and objects.
👉 Java does not have a preprocessor and therefore we cannot use #define , #include and #ifdef statements.
👉 Java does not contain the type the data types struct and union.
👉 Java does not support an explicit pointer type.
👉 Java does not define the modifiers keywords auto,extern,register,signed and unsigned.
👉 Java does not include the C unique statement keywords sizeof and typedef.

Difference Between Java and C++ Languages

👉 Java does not support global variables.Every variables and methods are declared inside a class only.
👉 Java does not use pointers concept.
👉 Java does not have template classes like as in C++.
👉 Java does not support operator overloading.
👉Java does not support multiple inheritance of classes.Inplace use new feature in Java is called Interface.
👉 Java is a platform independent language.
👉 Java does not support call by reference and only support call by value.
👉 Java does not support destructors,it offers finalize() method.

Java Architecture

There are various components of the Java architecture are
👉 Java Programming Language
👉 Java Class File
👉 Java Virtual Machine (JVM)
👉 Java Application Programming Interface (API)

Java Programming Language and Java Class File

Java programs are saved with an extension, (.java ) . Any ".java file" is compiled to generate the ".class file", which contains the Bytecode. The JVM converts the Bytecode contained in the ".class file" to machine object code. The JVM needs to be implemented for each platform running on a different operating systems.For Example simple Factorial program
class Factorial
{
public static void main(String args[])
{
int factorial = fact(5);
System.out.println("Factorial of 5 is: "+factorial);
}
static int fact(int n)
{
int fact;
if(n==1)
{
return 1;
}
fact = fact(n-1)*n;
return fact;
}
}
Compilation: javac Factorial.java
Execution: java Factorial
Output: 120.
Class name is Factorial therefore save this program as "Factorial.java" file after run this program then generate by default "Factorial.class" file.

Java Class → Java Compiler → Byte Code → Java Interpreter → Machine Object Code


Java Virtual Machine( JVM )

The Java Virtual Machine is a program that interprets the intermediate Java byte code and generates the desired output.It is because of byte code and JVM concepts that programs written in Java are highly portable or implement it in hardware.The compiler takes the Java application source code and generates byte code.Bytecode are machine code instruction for the JVM.All Java Technology interpreter, regardless of whether it is a Java technology development tool or a web browser that run appletes, has an implementation of the JVM.
JVM specification provides concrete definition for an instruction set, a register set, the class file format, a runtime stack, garbage collected heap, a memory area, fatal error reporting mechanism, and high precision timing support.The JVM design enables the creation of implementation for multiple operating environments.For example, Sun Microsystems provides implementatios of the JVM for the Linux,Unix,Microsoft Windows and Solaris Operating Systems environments.
Below there are following parts of JVM.But here only major parts of JVM will be discuss.

Class Loader
Execution Engine
Just-In-Time (JIT) Compiler

👆 Class Loader ⇒ The class loader loads the class files, which are required by a program running inside the memory.The classes are loaded dynamically when required by the currently executing program.
👆 Execution Engine ⇒ The Java execution engine is the part of the JVM that runs the Bytecode one line after another.The execution engines implemented by different vendors use different techniques to run the Bytecode.The Java execution engine converts the Bytecode to the Machine objects code and execute it.
👆 Just-In-Time (JIT) Compiler ⇒ The JIT Compiler is used for compiling the Bytecode into executable code.The JVM runs the JIT compiled code without interpreting because the JIT compiled code is in the Machine code format.Because the JIT compiled code is faster than running the interpreted code therefore it does not require to be run, line by line.

Diagram Represntation Of JVM


JVM




Java Application Programming Interface( API )

The Java API is a collection of software components that provide capabilities,such as Graphical User Interface (GUI). It includes all Java packages, classes, and interfaces,along with their methods, fields, and constructors.In the Java API,Classes are grouped into packages.To use a class in the API , We have to know which package of the class belong.Every class in the Java Library contain a package.
For example
java.util package(This package contains the collections framework, date and time utility functions).
java.awt package(Abstract window tool kit package contains classes that implements platform independent GUI).
java.lang package(String and Math belong to this package).
java.io package(For System input and output through data streams, serialization and the file system).
java.net package(For implementing networking applications).
javax.crypto package(The classes and interfaces provides for cryptographic operations).

Diagram Represntation Of API




Home Back Next Click