Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Monday, 11 November 2013

THE VIRTUAL MACHINE (JVM) [PDF]

 The JVM plays an important role in making Java language portable and platform-independent as it hides the details of implementation between the hardware requirement  and the operating system. JVM runs the compiled Java programs and provides compatibility between the compiled Java program and the system, where the program is executed.

Java programs are compiled into calls using the executable file, javac. A Java compiler generates the byte code and loads it in JVM using the JVM class loaders. The JVM class loaders load the class file and execute the byte code in accordance with the operating system and the hardware configuration. JVM allows you to execute a Java program an any operating system such as UNIX system, Windows system of Macintosh system,

Pigure  ; The Java interpreter executes the byte code that are generated by a Java compiler and converts the byte codes into machine-readable code.

The class loaders in JVM allocate memory to the loaded Java class file. Class loaders also provide mobility to the Java programs as these class loaders allow the source code to de dynamically linked across the network. Class loaders also provide network security to the Java programs.
The class loaders in JVM are of two types: primordial class loader the Java Application Programming Interface (API) at the time of executing a Java program. You can instantiate multiple class loader. during  run-time to load the class files in machine memory.
The Java class files obtained after compilation are loaded into JVM using the Java class loaders. The Java API class files are also loaded in the class loader of JVM. The execution engine interacts with the host operating system by invoking the native method while executing a program on JVM. The two ways by which you can invoke native methods are Java method and Native method. 
The native methods are written in a non-Java programming language such as C++ or assembly language and are compiled into the native machine code. The native methods are plarform-dependent and are stored in Dynamic Linked Libraries (DLLs).

Friday, 8 November 2013

THE HISTORY OF JAVA WITH TUTORIAL

 In year 1991, a group of engineers at Sun Microsystems Laboratory
developed the Java language. The Sun Microsystems engineers. Patrick Naughton and james Gosling
wanted to design a programming language for the development of software that could used in different consumer electronic devices such as VCRs, toasters, and cable television switch boxes.The team of sun Microsystems engineer designed a project which they named as Green Project.
The Green Project engineer designed a portable language that was small in nature, as its memory requirement
was less and it could also be used to generate an intermediated code for virtual machines such as the java Virtual Machine code. This Process of generating and interpreting the intermediate code less memory space and, thereby, provided compatibility to a variety of consumer electronic devices.  The newly developed language was named oak wich was based on C++ and followed the object-oriented programming approach . The oak programming language was later renamed Java and was introduced with this new name in year 1995. In year 1993 the first graphical wed browser Mosaic was released in the market. During this time
Internet on their machines which run on variety of OS and hardware configuration.
Due to the increasing popularity of the web, the Sun engineers decided to use Java for Internet by utilizing its feature of platform independence.
Patrick Naughton and Jonathan Payne built the Hot Java web browser written in the Java language . This web browser was made capable of interpreting the intermediate code for Java.

THE FEATURES OF JAVA

Java inherits most of its features from the previous object-oriented programming languages suc as C++.
The various features of Java are:
  • Compiled and Interpreted 
  • Platform- Independent and Portable
  • Object-Oriented Programming Approach
  • Robust and Secure
  • Simple and Distributed
  • Small and Familiar
  • Multi-threaded and Interactive
  • High Performance 
  • Dynamic and Extensible
Compiled and Interpreted : Java is a compiled and interpreted language.The Java Compiler translates the 
program code into a compiled format known as byte code instruction . The byte code instructions can be executed by using the Java Virtual Machine (JVM) on any system irrespective of the hardware configuration and oprating system of the system in use. JVM is abstract computing machine that is used for interpreting 
compiled byte code instruction.

Platform- independent and Portable:A Java program has a unique feature of portability. Java programs can be easily transferred form one computer another and code be executed anywhere and any time .Java
provides portability as the Java compiler generates the byte code instruction that you can implement on any machine irrespective of the operating system of the processor.

Object-oriented Approach: Java is an object-oriented language that supports various object-oriented programming (OOPs) features such as polymorphism, data and inheritance. Java enables you to store the program code and data in the form of object and classes. 

Robust and Secure: Java also supports the feature of exception handling,  which detects the errors and exception and reduces the possibility of run-time errors. Java ensures that the downloaded  applet is virus-free.  Applet is a small Java program that executes in a web browser, but can be executed in other applications or devices that support the Applet programming model. Java also supports the feature of garbage collection,
Which solves the memory management problem by deleting unused objects form the memory. 

Simple and Distributed: The syntax for the Java language is similar to that of the C++ and C. The end user, who is familiar with C and C++, requires less effort in learning Java Because Java and C or C++ have a similar syntax. Java is a simpler language than the existing language and dose not implement some of the redundant and complex concepts of C and  C++.
 
Small and familiar:OOPs concept of inheritance allows the programmers and developers to re-use the pre-defined classes and objects in the programming code.
Multi-threaded and Interactive: Java supports the process of multi-threading that allows you to simultaneously perform multiples tasks. Multi-threading allows you to staks, the Java run-time environment supports multi-process synchronisation.
High Performance: Java enables the developer to create high-performance applications as the programs are first converted into byte code and that byte code is easily translated into machine language. Java programs require less memory and are faster to execute also increase their performance

Dynamic and Extensible: Java is more dynamic then C++ or C language because it allows dynamic linking of  classes to libraries and per_defined methods and objects. You can use programs written in other programming language such as C and C++ in Java, by dynamically linking then to the Java run-time environment. Java run time environment makes inter-connections between the modules of a program at run-time. You can also add new methods and temporary variables in the existing libraries.