Variables in JAVA

In a computer, the memory is defined as a collection of numerous bytes. The main use of memory is to store and retrieve data. To do so, we require a concept of variables.

Variables are defined as identifiers which are used to locate bytes that consist of data. To use a variable we need to declare the variable.

Rules to declare variable are:

  1. The name of the variable must be specified.
  2. The type of data to be stored must be specified.


Datatypes are used to specify the type of data stored in variables.

various types of information that can be stored in the object are :

  1. Integers
  2. Real Numbers
  3. Characters
  4. Boolean type


Syntax:  Datatype variableName;




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Powered by

Up ↑

%d bloggers like this: