Introduction to Java
History:
· This language was developed at SUN Microsystems in the year 1995 under the guidance of James Gosling and there team.
· It is a programming language suitable to the development of web applications.
· It is also used for develop desktop and mobile application.
Overview of Java
· Originally SUN Micro Systems is one of the Academic university (Standford University Network).
· In the year 1990, SUN Micro Systems has released on the name of oak, which is original name of java (scientifically oak is one of the tree name). The OAK has taken 18 months to develop.
Java divided into three categories, they are
· J2SE (Java 2 Standard Edition)
· J2EE (Java 2 Enterprise Edition)
· J2ME (Java 2 Micro or Mobile Edition)
J2SE
J2SE is used for developing client side applications.
J2EE
J2EE is used for developing server side applications.
J2ME
J2ME is used for developing mobile or wireless application by making use of a predefined protocol called WAP (wireless Access / Application protocol).
Basic of Java
Java is a platform independent, more powerful, secure, high performance, multithreaded programming language.
Define byte
Byte code is the set of optimized instructions generated during compilation phase and it is more powerful than ordinary pointer code.
Define JRE
The Java Runtime Environment (JRE) is part of the Java Development Kit (JDK). It contains set of libraries and tools for developing java application. The Java Runtime Environment provides the minimum requirements for executing a Java application.
Define JVM
JVM is set of programs developed by sun Micro System and supplied as a part of jdk for reading line by line line of byte code and it converts into native understanding form of operating system. Java language is one of the compiled and interpreted programming language.
Garbage Collector
Garbage Collector is the system Java program which runs in the background along with regular Java program to collect un-Referenced (unused) memory space for improving the performance of our applications.
Definition of JIT
JIT is the set of programs developed by SUN Micro System and added as a part of JVM, to speed up the interpretation phase.
Network based application
Network based application are mainly classified into two types.
· Centralized applications
· Distributed applications
Centralized applications
In this scenario multiple clients system depends on single server system.
The major drawback in this architecture is if any problem occurred on server system that will be reflected on every client system.
Distributed applications
In this scenario multiple client system are depends on multiple server systems so that even problem occurred in one server will never be reflected on any client system.
Features of Java
1. Simple
It is simple because of the following factors:
· It is free from pointer due to this execution time of application is improve. [Whenever we write a Java program without pointers then internally it is converted into the equivalent pointer program].
· It has Garbage Collector which is always used to collect un-Referenced (unused) Memory location for improving performance of a Java program.
· It contains user friendly syntax for developing any applications.
2. Platform Independent
A program or technology is said to be platform independent if and only if which can run on all available operating systems with respect to its development and compilation. (Platform represents O.S).
3. Architectural Neutral
Architecture represents processor.
A Language or Technology is said to be Architectural neutral which can run on any available processors in the real world.
4. Portable
If any language supports platform independent and architectural neutral feature known as portable. The languages like C, CPP, and Pascal are treated as non-portable language. It is a portable language.
5. Multithreaded
A flow of control is known as thread. When any Language execute multiple thread at a time that language is known as multithreaded Language. It is multithreaded Language.
6. Distributed
Using this language we can create distributed application.
7. Networked
It is mainly design for web based applications, J2EE is used for developing network based applications.
8. Robust
Simply means of Robust is strong. It is robust or strong Programming Language because of its capability to handle Run-time Error, automatic garbage collection, lack of pointer concept, Exception Handling. All these points make it robust Language.
9. Dynamic
It support Dynamic memory allocation due to this memory wastage is reduce and improve performance of application. The process of allocating the memory space to the input of the program at a run-time is known as dynamic memory allocation, To programming to allocate memory space by dynamically we use an operator called 'new' 'new' operator is known as dynamic memory allocation operator.
10. Secure
It is more secured language compare to other language; In this language all code is covered into byte code after compilation which is not readable by human.
11. High performance
It have high performance because of following reasons;
· This language uses Bytecode which is more faster than ordinary pointer code so Performance of this language is high.
· Garbage collector, collect the unused memory space and improve the performance of application.
· It have no pointers so that using this language we can develop an application very easily.
· It support multithreading, because of this time consuming process can be reduced to execute the program.
12. Interpreted
It is one of the highly interpreted programming languages.
13. Object Oriented
It supports OOP's concepts because of this it is most secure language,
Java Program
During the program execution internally following steps will be occurs.
· Class loader subsystem loads or transfer the specified class into main memory(RAM) from secondary memory(hard disk)
· JVM takes the loaded class
· JVM looks for main method because each and every java program start executing from main () method.
· Since main() method of java is static in nature, JVM call the main() method with respect to loaded class (Example: First as First.main(--))
Note: A java program can contain any number of main method but JVM start execution from that main() method which is taking array of object of String class.
Compiling and executing the java program
Difference between JDK, JVM and JRE
· JVM, JRE, Jdk all are the backbone of java language.
· Each component has separate works.
· Jdk and Jre physically exist but Jvm are abstract machine it means it not physically exists.
JVM
· JVM (Java Virtual Machine) is software.
· It is a specification that provides runtime environment in which java bytecode can be executed.
· It is not physically exists.
· JVMs are not same for all hardware and software, for example for window OS JVM is different and for Linux VJM is different.
· JVM, JRE and JDK are platform dependent because configuration of each OS differs. But, Java is platform independent.
JRE
· The Java Runtime Environment (JRE) is part of the Java Development Kit (JDK).
· It contains set of libraries and tools for developing java application.
· The Java Runtime Environment provides the minimum requirements for executing a Java application.
· It physically exists. It contains set of libraries + other files that JVM uses at runtime.
JDK
· The Java Development Kit (JDK) is primary components.
· It physically exists.
· It is collection of programming tools and JRE, JVM.
What is JIT and why use JIT
· JIT is the set of programs developed by SUN Micro System and added as a part of JVM, to speed up the interpretation phase.
· In the older version of java compilation phase is so faster than interpretation phase. Industry has complained to the SUN Micro System saying that compilation phase is very faster and interpretation phase is very slow.
· So solve this issue, SUN Micro System has developed a program called JIT (just in time compiler) and added as a part of JVM to speed up the interpretation phase. In the current version of java interpretation phase is so faster than compilation phase. Hence java is one of the highly interpreted programming languages.
Execution Engine
· It contains Interpreter and JIT compiler.
· Whenever any java program is executing at the first time interpreter will comes and converts one by one byte code instruction into machine level instruction.
· JIT compiler (just in time compiler) will comes from the second time onward if the same java program is executing and it gives the machine level instruction to the process which are available in the buffer memory.
· Note: The main aim of JIT compiler is to speed up the execution of java program.
No comments:
Post a Comment