From fadfbca63c09cfd05ed4cfb444386d7e0cf89693 Mon Sep 17 00:00:00 2001 From: Aaditree <43510617+Aaditree@users.noreply.github.com> Date: Fri, 15 Feb 2019 02:50:07 +0530 Subject: [PATCH] Types of variables (#29670) Types of variables specified in a class. --- guide/english/java/variables/index.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/guide/english/java/variables/index.md b/guide/english/java/variables/index.md index 03b82b55e7..7b7f30f5ca 100644 --- a/guide/english/java/variables/index.md +++ b/guide/english/java/variables/index.md @@ -47,15 +47,21 @@ int byteValue = 0B101; byte anotherByte = (byte)0b00100001; ``` +## Variable Data Types As evident from the above example, variables of Primitive type behave slightly differently from variables of Reference (& Wrapper) type - while Primitive variables store the actual value, Reference variables refer to an 'object' containing the actual value. Java Programming language defines mainly three kind of variables. -1) Instance variables -2) Static Variables -3) Local Variables -You can find out more in the sections linked below. +1. Local Variable: +It is declared inside the method and can only be used within the method itself. -# Other Resources +2. Static variable: +Any variable which has the keyword static is called a static variable . +It cannot be created as a local variable. Once created , it can be used among all the instances of the class. + +3. Instance Variable: +It is declared inside a class but not in a specific method body. + +## Other Resources * Data Types * Classes and Objects