what do you mean by data type easy way of learning

Data type : It defines the type of data or  the data is of which type.

Data type is of two types or we can also say variables are of two type .

  1. Primitive data type .
  2. non Primitive data type .

  Primitive data type : Size of the data is fixed . example : int a =6 ; It means a is variable of int data type which contains the value 6 . int , short , long ,float , char ,double these are primitive data  types. int - 4 bytes  , short - 2 bytes  , long -8 bytes , float - 4 bytes , double - 8 bytes , char - 1 byte.

  Non primitive data type : Size of the data is not fixed . In non primitive since  size of the data is  not fixed  .  String and Array are the non primitive data type .

             example  : int marks[5] ={ 1 , 2 ,3 ,4 , 6} ;

   If we write using new keyword :  int [ ] marks =new int [5]; 
 In both the examples we make an array of  size 5 . we can make any size . so it is not fixed . Therefore it is known as non primitive data type . Data type in C and Data types in java both are two types.

Post a Comment

have you any doubt then ask.

Previous Post Next Post