Difference between JDK, JRE and JVM:

JVM

JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides runtime environment in which java bytecode can be executed.
JVMs are available for many hardware and software platforms. JVM, JRE and JDK are platform dependent because configuration of each OS differs. But, Java is platform independent.
The JVM performs following main tasks:
  • Loads code
  • Verifies code
  • Executes code
  • Provides runtime environment


JRE

JRE is an acronym for Java Runtime Environment.It is used to provide runtime environment.It is the implementation of JVM. It physically exists. It contains set of libraries + other files that JVM uses at runtime.
Implementation of JVMs are also actively released by other companies besides Sun Micro Systems.



JDK

JDK is an acronym for Java Development Kit.It physically exists.It contains JRE + development tools.

 How to Downlaod JDK.

       JDK   Download   from 
           www.oracle.com/technetwork/java/javase/downloads/‎
  
1.   Install it in C drive.

2.   After Complete of Installation.

3.   Go to C: drive then Program files then java and then  jdk 1.7.0 bin and then   open        properties  of     Applet viewer.
      Like:C:\Program Files\Java\jdk1.7.0\bin\appletviewer

4. After open properties Copy location.

     like  C:\Program Files\Java\jdk1.7.0\bin

5. then open property of computer and go to Advance system settings left on window enter.

6.  Enviroment  Variables  should be displayed.  Enter

7.  New  is in front of you click new button

8.  Two value filed is in front of you

       :Variable name:

       Variable path:

9.  In Variable name write path.

     in Variable path paste C:\Program Files\Java\jdk1.7.0\bin.

10. click Ok then   Again Ok enter.

     now Path is set.


  How to check path is set or not.

Press  Winlogo+r .
Type cmd Enter.
Cmd open.
In cmd type  javac.
lots of list of file come then you understand  Javapath is set.

What happens at compile time?

At compile time, java file is compiled by Java Compiler (It does not interact with OS) and converts the java code into byte code.




What happens at runtime?

At runtime, following steps are performed:

 Class: Class is blue print of object.
 Classloader: Class loader  is the subsystem of JVM that is used to load class files.

Bytecode Verifier:Bytecode Verifier checks the code fragments for illegal code that can violate access right to objects.
Interpreter: Interpreter read byte code stream then execute the instructions.


What happens at compile time?

At compile time, java file is compiled by Java Compiler (It does not interact with OS) and converts the java code into byte code.




What happens at runtime?

At runtime, following steps are performed:

 Class: Class is blue print of object.
 Classloader: Class loader  is the subsystem of JVM that is used to load class files.

Bytecode Verifier:Bytecode Verifier checks the code fragments for illegal code that can violate access right to objects.
Interpreter: Interpreter read byte code stream then execute the instructions.


                                Java Tutorials:


  What is Java:

Java is a programming language .
Java is a high level, robust, secured and object-oriented programming language.

 Where to Used: 

According to Sun, 3 billion devices run java. There are many devices where java is currently used. Some of them are as follows:
  1. Desktop Applications such as acrobat reader, media player, antivirus etc.
  2. Web Applications such as irctc.co.in etc.
  3. Enterprise Applications such as banking applications.
  4. Mobile
  5. Embedded System
  6. Smart Card
  7. Robotics
  8. Games etc



 Why to Used:


1. High Level Language
2. Robust
3. Secure
4. Platform Independent
5. Object Oriented





Java Example:

Source Code:

  1. class Simple{  
  2.     public static void main(String args[]){  
  3.      System.out.println("Hello Java");  
  4.     }  
  5. }                     Output: Hello Java  


                                Diff. B/w  Java  and C++:

           Java                                                                                                     C++

 Java is pure Object oriented language.                                 C++ is not pure object oriented language.
Java does not support  pointers.                                            C++ support pointers.
Java  does  not support  Multiple Inheritance.                         C++ support multiple inheritance.   
Write Once, Compile Any Where(WOCA).                           Write Once Run Any time.(WORA) 
 Java doesn't  provide global variables.                                    C++ provide global variables.

Java doesn't provide header files.                                            C++ has header files.

Java doesn't provide template class.                                     C++ support  template class.

Java uses compiler and interpreter both                               C++  has only Compiler.
Java  does  not support  Operator Overloading.                  C++ support operator overloading.
There is no go to statement in Java                                     C++ support go to statement.




Note:
Java was originally designed  by James Gosling and developer by Sun Microsystem (which has since been acquired by Oracle Corporation) and released in 1995