214,258 views 327 on YTPak
378 28

Published on 06 Mar 2013 | over 4 years ago

Take instructor-led Live class on Java Tutorial at :

The following topics were covered in this Java Tutorial:

Why Java needed?, the Genesis of Java, The Creation of Java, Why Java is important for Internet, The Important term in java BYTECODE, JVM, Java Virtual Machine, Naming Convention of Variables, if - else statement, Nested if - else, Switch Case statement, Operators.

What is Java?
Java is not just a programming language but it is complete platform for object oriented programming. It uses the OOP's concept like inheritance, encapsulation, polymorphism, overloading, overriding and so on. In java everything revolves around object i.e we have to create object in java to do anything because it is an object oriented language. There are two things present in java.
JRE(Java Runtime Environment):
Whenever you have to run java applications on your system you need an environment for that. E.g.: Human beings are able to live with the help of environment setup like oxygen, food etc for survival. JRE includes class libraries which provide Application Programming Interface (API) and JVM.
JDK(Java Development Kit):
It helps you to develop java applications. So you need to check whether jdk is installed on your system before developing a java application. JDK provides all the needed support for software development in java.
Byte code:
Java byte code is the form of instructions that JVM executes. A java programmer does not need to be aware of or understand java byte code at all. The model of computation of java byte code is that of a stack oriented programming language. Stack is a data structure that follows LIFO(Last In First Out) i.e the last element coming into stack is the first element comes out of stack.
Garbage Collection:
Garbage collection is related to memory management in java.As a programmer you are not responsible for memory management in java because it is completely handled JVM which has a thread "Garbage Collector" to do this.
How Java works?
Java compilers convert your code from human readable to something called "byte code "in the java world. i.e source code will be converted to .class file when compiled with javac compiler. JVM is machine dependent thing present in with every OS. Every JVM understands the byte code and convert into machine code which is understandable by that Computer/System.
What is JIT?
JIT (just-in --time) compiler is a program that turns java byte code into instructions that can be sent directly to the processor.
JVM has 2 things: Interpreter, JIT Compiler( subset of JVM)
Both of these (interpreter and JIT compiler) will work side by side to convert byte code into instructions that could be understood by machine or the processor.
In the figure we divide the environment into compile-time environment and run-time environment. In the compile-time environment we will write our java application and compile the source code into byte code i.e .class file. Now this .class file is sent to other computer through network or locally.
Now the environment is run-time environment. When the .class reaches the other computer it will find class loader that loads the class into JVM. Class loader verifies byte code if any malicious code is there with the help of java libraries and acts as gate keeper. After byte code verification JVM comes into action which has an interpreter and JIT compiler.
The interpreter will start interpreting .class file. The interpreter reads a line and converts into instruction and sends it to processor and moves to next line and does the same thing repeatedly for all line in the .class file.
What is the use of JIT compiler?
An interpreter will read the lines of the code one by one and convert into instructions whereas compiler reads the whole code at once and convert all of them into instructions at once. JIT compiler helps us in speeding up the execution when we have to execute set of statements repeatedly. When the interpreter encounters such type of statements it sends to compiler to execute that code. The compiler will compile and save these instructions into cache memory.
Cache memory is fastest and temporary memory. Now whenever the interpreter once again encounters the repeated code it fetches those instructions from cache memory and do not interpret. This way the interpretation is made faster. When all byte code is converted into instructions the application will run on the system to which we have sent our byte code.

Please write back to us at support@edureka.co or call us at +91-8880862004 for more information.


Visit - www.edureka.co/java-j2ee-soa-training

Loading related videos...