Variables in Java

Java offers a place-holder or a container to hold a value in a memory location till the program code execution gets finished called as Variables with a specified data type and the name of the variable is an identifier for the specified memory location.

Types of Variable in Java

  1. Local Variable
  2. Instance Variable
    • Non-static Instance Variable
    • Static Instance Variable
Random Access Memory (RAM)
Date Type: int
Name: age
6
Date Type: String
Name: str
Hello World
Date Type: boolean
Name: flag
true
Date Type: double
Name: diameter
15.63