L6, Types of Data Types, package q10743

What is Data Types ?

Computer programming is all about processing information. This information could be of different data formats(like Image, Audio, Video, Text etc). When it comes to computer programming, irrespective of the format, the data contained in those formats is represented in binary form, i.e. groups of Bits called as Bytes. (.i.e which essentially contain a combination of 0's and 1's).

For easier and efficient processing, data is classified into different types (Data Types) such as bytecharbooleanintfloatStringArrayEnum etc. These data types can be grouped as Primitive and Composite (or Reference Type).

As their names suggest, primitives form the primary building blocks(these usually have built-in support in the language) and composites are usually made up of one or more primitive type.

Each Data Type determines

  1. the meaning of the data that it represents
  2. the possible values it can take
  3. the way or format in which the value of this type is stored
  4. the possible operations that can be performed with it

Java is a statically typed language, which means that the type imposes some constraints on the value it can hold and the operations that can be performed, and this is verified by the compiler during the compilation.

In Java, we need to declare the type of a variable before being able to use it. For example if we want to store a value 25 in a variable with name age we cannot directly say
age = 25;
We have to first declare age to be of type int like:
int age; and then we can say
age = 25; or we can also declare and initialize in a single step, like below:
int age = 25;

We will learn more about various data types in the ensuing exercises.

Select all the correct statements given below.

  • The contents of PDF and Text files are not stored as bits in a Hard Disk.
  • If a text file contains only a decimal value 12, then the value 12 is stored as 1100 in its binary form

Post a Comment