Friday, July 28, 2017

Java variables and its data types

This article specially deals to understand about the variables in Java and its data types. It really helpful for the Java Beginners and Selenium Freshers who want to be a professional selenium tester. First we need to try to understand what is variable ?

Generally variables are  used to store the data that may be number,character or String(group of characters). Variable can be also referred as name of the reserved area allocated in memory location.

How to declare a variable ?

 int a = 100;  // a is the variable of type Integer that holds the value 100 reserved in the RAM.

There are different types of variables available in Java. Those variables are given as below.


  1. Local variable
  2. Instance variable 
  3. Static variable

Local variable:


Variables that are declared with in methods and it will have scope with in that method


Instance variable:

Variables that are declared with in Class area but not with in methods are termed as Instance variables. It can be used by all the methods inside that class. It denotes the state of that specific class.

Static variable:

If the variables is declared as static then it can be used as local. Value of the variable can be changed only in static methods. Modification of static static variable will be reflected in the all the objects or instances using that variable.

What is meant by Datatype ?

Datatype is to denote that what type of data is going to be stored in specific variable. Two different types of datatypes are listed below.


·         primitive data types

·         non-primitive data types


Data Type
Default Value
Default size
boolean
false
1 bit
char
'\u0000'
2 byte
byte
0
1 byte
short
0
2 byte
int
0
4 byte
long
0L
8 byte
float
0.0f
4 byte
double
0.0d
8 byte







7 comments:

  1. Really nice experience you have. Thank you for sharing. It will surely be an experience to someone.

    DevOps Training in chennai

    DevOps Training in Bangalore

    ReplyDelete
  2. You blog post is just completely quality and informative. Many new facts and information which I have not heard about before. Keep sharing more blog posts.

    Tableau Training in Bangalore

    DevOps Training in Bangalore

    Tableau Training in Chennai

    Tableau Training in Bangalore

    ReplyDelete
  3. I just recently discovered your blog and have now scrolled through the entire thing several times. I am very impressed and inspired by your skill and creativity, and your "style" is very much in line with mine. I hope you keep blogging and sharing your design idea


    web designing training in chennai

    web designing training in velachery

    digital marketing training in chennai

    digital marketing training in velachery

    rpa training in chennai

    rpa training in velachery

    tally training in chennai

    tally training in velachery



    ReplyDelete