Wednesday, June 10, 2015

Variable declarations and initialization

7:34 AM

Variable

Variable is an identifier which holds data or another one variable is an identifier whose value can be changed at the execution time of program. Variable is an identifier which can be used to identify input data in a program.

Syntax: Variable_name = value;


Rules to declare a Variable

  • Every variable name should start with either alphabets or underscore ( _ ) or dollar ( $ ) symbol.
  • No space are allowed in the variable declarations.
  • Except underscore ( _ ) no special symbol are allowed in the middle of variable declaration
  • Variable name always should exist in the left hand side of assignment operators.
  • Maximum length of variable is 64 characters.
  • No keywords should access variable name.

Variable declarations

syntax:

         Datatype  variable_name;
             byte  b1;
 
 

Variable initialization

  It is the process of storing user defined values at the time of   allocation of memory space.

Variable assignment

     Value is assigned to a variable if that is already declared or initialized

syntax:
                        Variable_Name = value;
                         int a = 140;
 

Written by

We are Creative Blogger Theme Wavers which provides user friendly, effective and easy to use themes. Each support has free and providing HD support screen casting.

0 comments:

Post a Comment

 

© 2013 Java Tutorials. All rights resevered. Designed by Templateism

Back To Top