Wednesday, October 26, 2022

Introduction of Java - Part 1

Introduction of Java

 

A team of 5 members of Sun Microsystems Inc.  James  Gosling,  Patrick  Naughton, Chris Warth, Ed Frank and Mike Sheridan developed a programming language named OAK in 1991 to program for an electronic devices (Home Appliances). Oak” was renamed as Java in 1995. Java is a 3rd Generation OOP language as well as a leader for Internet Programming.

 

Type of Java Programs:

1.     Application Program    :

A Stand Alone program that runs as a true application without a browser using JVM is known as Application Program which usually contains a main function.

2.     Applet Program  :

A Java program that can be included in an HTML page which can  be executed on a web browser. It uses a java.applet package to add small interactive components to a webpage.

Translator: The computer understands only Machine Language. So the programs written in any programming language (High-Level Language or Object-Oriented Language) must be translated into a Machine Language, so that the computer can understand an execute it.

 

Translation Process in High-Level Languages

 

Source Program in HLL

Compiler

(All at Once)

Machine Language

( Source Code )

 

 

(

Machine Code) or

( Object Code )

 

 

Source Program in HLL

 

Interpreter

(Line-by-Line)

 

Machine Language

( Source Code )

 

 

 

(Machine Code) or

( Object Code )

 

Java Program Translation Process:

Java uses two translators:                      

Java Compiler & Java Interpreter

 

 

Java Source Program

Java Compiler ( javac )

Java Byte Code

Java Interpreter ( java )

JVM

Machine Language

( Source Code )

.java file

 

 

 

( Native Code )

.class file

 

 

(

Machine Code)

or

( Object Code )

 

 

Java program is first translated by Java Compiler which converts the given Source Code into  Java Byte Code. The Java Byte Code is a Native Code which is a common for all types of machines irrespective of the hardware or software used in a machine. In next step, Java Interpreter (JVM) will translate the Java Byte Code into Machine Language which can be executed on end-user computer.

i.e.     Java  programs  using  a  compiler  (javac)  for  converting  Java  source  code  (.java  files)  to Java bytecode (.class files). Once this is done, Java Virtual Machine (JVM) loads the .class files at run time and converts them to a machine understandable code using an interpreter.

 

Java is a Platform-Independent  Language  which  means  the  program  written  in  a  Java  Language can be executed on any kind of platform irrespective of the hardware or software used in a machine without any changes in Java program. It also known as WORA (Write Once Run Anywhere)

 

Java Development Kit (JDK) is a bundle of software components that is used to develop Java based applications includes JRE, and the compilers and tools (like JavaDoc, and Java Debugger) to create and compile programs.

 

JRE is an acronym for Java Runtime Environment. It is an implementation of the Java Virtual machine, which actually executes Java programs. It includes the JVM (Java Virtual machine), core libraries and other additional components to run applications and applets written in Java.

 

The JDK is a superset of the JRE, and contains everything that is in the JRE, plus tools such as the compilers and debuggers necessary for developing applets and applications. It also includes browser plugins for Applet execution. The JRE does not contain tools and utilities such as compilers or debuggers for developing applets and applications.

 

Usually, when you only care about running Java programs on your browser or computer you will only install JRE. That's all you need. On the other hand, if you are planning to do some Java development, you will also need JDK.

 

 

Features of Java:

1.      Simple Coding

2.      Robust – Java provides a automatic memory management and a garbage collection along with strong exception handling (checking & handling for errors) mechanism that makes it robust.

3.      Secured it support many in-built security that makes the system secure from crash.

4.      Object Oriented It support OOPs concepts.

5.      Platform Independent

6.       WORA - Write Once Run Anywhere

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home