What are Variables, Constants, Identifiers & Data Types (in JAVA) ?

What are Variables, Constants, Identifiers & Data Types (in JAVA) ?

Today i am going to discuss about Variables and Constants here w.r.t JAVA. Please note that the definition of Variables and Constants is same for all languages so, what ever i tell here is not just limited to JAVA i.e you can apply it in any language only syntax will change.

Let me start with Variables.


What are Variables ?

It is a name given to a memory location where value can be out. A variable can hold only a single value at a time.


Value of a variable can change during execution of the program.


What are Constants ?

Its value never changes during execution of the program.

to define a constant final keyword is used


NOTE: A is a constant and it must be uppercase.


What are Identifiers ?

It is a name given to a variable or constant or method or class.

Rules for Identifiers :-

  1. It can be a combination of alphabets (a-z, A-Z) or digits (0-9) and a special character ‘_’.
  2. Identifier name can begin with either alphabets of underscore only.
  3. space should not be given in identifier.


Identifier Comment
a_b_c correct
abc correct
Abc correct
2abc wrong
@ab wrong
a b c wrong
a2b correct
a_2b correct

What are Data Types ?

It specifies the type of data to be stored in a variable.

Data Types can be Predefined (or Library or Primitive) and User defined

Data Type Comment
byte 1 byte
char 2 bytes
int 4 bytes
float 4 bytes
double 8 bytes


Do you have Questions in your mind or just need Help ?

You can ask your questions here at https://ask.thesmartware.com/t/what-are-variables-constants-identifiers-data-types-in-java/160 and get it answered or helped out within hours. that’s it !

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.


I am a Person who Loves to Do Innovative things.

You may also like...


Get the latest posts delivered to your mailbox: