Variable constants and data types

What is DATA?

Data is the representation of anything.
 so it can be either constant or variables.

So from the basic mathematical definition:
Constant: Entity whose value can not be changed.
Variable: Entity whose value can be changed.
consider we have an equation:

 (x-5)(x+5) = 0
then the value of x will be -5 and 5.

You can notice that value of x is changing. so it is called variable and the value 5 or -5 is constant.

we will mainly focus on variable.

so in programming terms, variables are defined as:
Variables are just a placeholder.
There are 2 types of Data:
  1. primitive
  2. Non primitive
 Primitive types are system defined data types. They are:
  1. int
  2. short
  3. long
  4. byte
  5. float
  6. double
  7. boolean
  8. char
First 4 of them are used for round number integers.
5th and 6th one are used for decimal number representation
7th is used as condition- either true or false
8th is used for alphabets representation.


Each data type has a default size and range.


Now let's learn its implementation




The non-primitive data types are referred as user defined data types. Example:
  1. String
  2. Array
  3. objects ..etc
we will learn non-primitive data types in coming posts.

Comments

Related Posts Plugin for WordPress, Blogger...