VARIABLES AND DATA TYPES IN JAVA

(June 15,2016)

Today, i have learnt about the variables and data types in java and their use.

Variables:-

Variable is name of reserved area allocated in memory. In other words, it is a name of memory location. It is a combination of “vary + able” that means its value can be changed.

typesofvariable

1) Local Variable

A variable which is declared inside the method is called local variable.

2) Instance Variable

A variable which is declared inside the class but outside the method, is called instance variable . It is not declared as static.

3) Static variable

A variable that is declared as static is called static variable. It cannot be local.

Data Types:-

Data types represent the different values to be stored in the variable. In java, there are two types of data types:

  • Primitive data types
  • Non-primitive data types      datatype2

 

Leave a comment