What is JVM,JRE,JDK ?

What is JVM?

  • JVM stands for Java Virtual Machine.
  • JVM is the virtual machine that runs under the java bytecode.
  • The JVM doesn't understand the java source code that is why you compile your ".java" files to obtain ".class" files that contains the bytecode understood by the JVM.
  • The same bytecode gives the same results makes java program platform independent language.
  • The main advantage of java program is write the code once and run it anywhere.(i.e run in any operating system like windows,Linux,Mac..)
  • let's try to understand the work of JVM- we write the code in any text-editor,save your program in ".java"(Ex- Sp.java). When you compile your java program using "javac" compiler, the compile convert your code into bytecode, which is exactly understand by the JVM.

What is JIT compiler?

JIT compilers is the part of JVM which increases the speed of execution of java program.

What is JRE?

  • JRE stands for Java Runtime Environment.
  • JRE provides the libraries ,the java virtual machine and other components to run applets and applications written in the  java programming language.
  •  JRE=JVM+set of libraries+other additional files
  • The JRE does not contain tools and utilites such as compilers or debuggers for developing applets and applications.

What is JDK?

  • JDK stands for Java Development Kit.
  • JDK is a superset of the JRE and contains everything that is the JRE,puts tools such as compilers and debugger necessary for developing applets and applications.
        JDK=JRE + Development tools
        JDK=(JVM + Set of libraries+ other additional files)+Development tools


Let's see the basic java program,
Ex-
         class Sp
        {
            public static void main(String[] ar)
                {
                    System.out.println("Welcome to Sp:)Learn");
                }
        }
  • Save the program in your local system in name "Sp.java".
  • For compile use "javac Sp.java".
  • After successfully compilation the compiler create the "Sp.class" file for JVM, further step is run the program. for run the code we write "java Sp".
  • The output of the above program is:                                                                                Welcome to Sp:)Learn
Let's discuss the parts of the above java program:
  • Public: Public is a keyword of access modifier which represents visibility. It means it is visible to all over the class.(we can discuss about the access modifiers in our further topics)
  • Class: It is a keyword used to declare class in java.
  • Static: It is also a type of keyword. If we declare any method as static it is known as static method. The core advantage of static method is that there is no need to create object to invoke the static method.
  • Void: void is the return type of the method. It means it doesn't return any value.
  • Main: main represents start-point of the program. It means every java program start its execution from main method. It is the entry point of the java program.
  • String[] ar : it is used for command line argument.
  • System.out.println(""): it is used to print the statement.

---Thank You---

Comments

Popular posts from this blog

What is C# ?

Communication Skills

7 Habits of Highly Effective People Book Summary