Wednesday, 27 July 2011

Just in Time Compilers (JIT)



-The Java Virtual Machine includes an optional ‘just-in time’ (JIT) compiler.
-The JIT:

       -Dynamically compilers byte code into executable code
       -Takes byte codes and compilers them into native code for the machine
       -Compiles programs on a methods by method basis just before they are called
       -Is faster than the Java Virtual Machine

Process of compilation

Java virtual Machine



  • All language compilers translate source code into machine code for a specific computer.
  • Java compiler produces an intermediate code known as byte-code for a machine.
  • This machine is called Java Virtual Machine (JVM ) and it exists only inside the computer’s memory.
  • It is simulator of computer wihin the computer and does all major functions of a real computer.                                                                                                                                                                    

Tuesday, 26 July 2011

Process of building and running java application programs


Difference Between applet and application


Application
Application can be directly executed by a Java.exe tool
Java Interpreters runs the application
We require JVM to run java application program.

Applet
Applet require web browser for their execution. Their execution is embedded within web pages .
Applet viewer can be used to run an applet.
An applet written by any developer in the world may be dynamically download from a web server and executed on a client PC.


Data Types



 Data types
-Integers
-long (64 bit)
-Int(16 bit)
-short(16,bit)
-byte(8 bit)
-Floating-pointer numbers
-double(64 bit)
-float(32 bit)
-Characters(char, 16 bit)
-Booleans (Boolean, true or false)

Arrays
-Arrays in Java work differently than they do in other languages
-First declare the array
                        Int month_days=new int[12];
-Arrays can be initialized during declaration
-Multidimensional arrays
                        Int twoDp[][]=new int[4][5];
-Alternative array declaration
                        Int [] a2=new int[3];

Java’s Magic: The Bytecode


The secrets behind the security and portability of Java is that the output of a Java computer is not executable code.Rather, it is Bytecode  
Bytecode is a highly optimized set of instructions designed to be executed by the Java run-time system, which is called the Java Virtual Machine (JVM)
JVM is an interpreter of Bytecode        
Java systems contain:
-Environment
-Language
-APIs
-Class libraries
Java programs normally undergo five phases
(1)    Edit
-Programmer writes program )and stores program on disk)
(2)    Complete
-Compiler creates bytecodes from program
(3) Load
-Class loader stores bytecodes in memory
(4)Verify
-Verifier ensures bytecodes do not violate security requirements
(5)Execute
-Interpreter translates bytecodes into machine language
Benefits of Bytecode
-Translating a Java program into Bytecode helps makes it much easier to run a program in a wide variety of environments
-Only JVM needs to be implemented for each platform
-Once the run time package exists for a given system, any java program can run on it

      

Twitter Delicious Facebook Digg Stumbleupon Favorites More