What Is JDK, JRE and JVM
the difference between JDK, JRE and JVM is important in Java. We are having overview of JVM .JVM (Java Virtual Machine)
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.What is JVM
A specification where working of Java Virtual Machine is specified. But implementation provider is independent to choose the algorithm. Its implementation has been provided by Sun and other companies. An implementation Its implementation is known as JRE (Java Runtime Environment). Runtime Instance Whenever you write java command on the command prompt to run the java class, an instance of JVM is created.What it does
The JVM performs following main tasks: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. JRE stands for Java Runtime Environment which is used to provide an environment at run time. It is the cause of implementation of JVM (as discussed earlier). It contains set of supporting libraries in combination with core classes and various other files that are used by JVM at run time. JRE is a part of JDK (Java Development Toolkit) but can be downloaded separately.
JDK
JDK (Java SE Development Kit) Includes a complete JRE (Java Runtime Environment) plus tools for developing, debugging, and monitoring Java applications. JDK is required to develop and run Java applications and applets. JDK is an acronym for Java Development Kit.It physically exists.It contains JRE + development tools.
variable in java
Variables are the identifier of the memory location, which used to save data temporary for later use in the program.Variable Definition in Java
syntax:
type variable_name;
type variable_name, variable_name, variable_name;
Example:
/* variable definition and initialization */ int width, height=5; char letter='C'; float age, area; double d; /* actual initialization */ width = 10; age = 26.5;
Rules of Declaring variables in Java
Types of Variables in Java
There are three types of variables in Java:class A { int amount = 100; //instance variable static int pin = 2315; //static variable public static void main(String[] args) { int age = 35; //local variable } }
public class Example { int salary; // Instance Variable public void show() { int value = 2; // Local variable value = value + 10; System.out.println("The Value is : " + value); salary = 10000; System.out.println("The salary is : " + salary); } public static void main(String args[]) { Example eg = new Example(); eg.show(); } }