You are on page 1of 6

COMPUTER

PROGRAMMING
DATA TYPES
DATA TYPES
 Are used to distinguish what type of
variable is used in a programming
language.
 A variable can be in the form of whole
numbers, numbers with a decimal point,
characters, or a series of characters.
 Data type allows the programmer to
specify what kind of data is stored in the
computer’s memory.

COMMON DATA TYPES


EXAMPLES :

Boolean
 Boolean data type has only two possible
values which is either a True or a False.
 When declaring a variable using a
boolean data type, one can simply write:
▫ boolean lessonFun = true;
▫ boolean lessonFun = false;

Byte
 A byte data type accepts a number from
-128 to 127. This data type is efficiently
used in saving memory spaces.
 When declaring a variable using a byte
data type, one can simply write:
▫ byte number;
▫ byte number = 22;

Short
 A short data type accepts numeric
data from a minimum value of -32,768 to
a maximum of 32,767.
 When declaring a variable using a
short data type, one can simply write:
▫ short number;
▫ short number = 22;

Int
 A numeric value ranging from -
2,147,483,648 to 2,147,483,647.
 When declaring a variable using an
int data type, one can simply write:
▫ int number;
▫ int number = 22;

Long
 A numeric value ranging from -
9,233,372,036,854,775,808 to
9,223,372,036,854,775,807.
 When declaring a variable using the
long data type, one can simply write:
▫ long number;
▫ long number = 22;
Float
 This data type accepts number with a
decimal point. The value of the float
ranges from 1.4013 x 10 -45 to 3.4028 x 10
+38
.
 When declaring a variable using a
float data type, one can simply write:
▫ float number;
▫ float number = 22.5;

Double
 This data type accepts number with a
decimal point and its value ranges from
4.9407 x 10 -324 to 1.7977 x 10 +308.
 When declaring a variable using a double
data type, one can simply write:
▫ double number;
▫ double number = 22.5;

Char
 Composed of UNICODE characters.
Unicode character is a universal encoding
standard that represents each character in a
computer system.
 When declaring a variable using a char
data type, one can simply write:
▫ char name; name: Kate
▫ char status [20];

String
 A string can contain any sequence of
characters, visible or invisible, and
characters may be repeated.
 Used for data values that are made up of
ordered sequences of characters, such as
“hello world”. When declaring a variable
using a String data type, one can simply
write:
▫ String name;
▫ String name = “hello world”;

MEMBERS:
 Cambel, Neza Chris
 Capasgordo, Nieva
 Igbacol, Chlea
 Llena, Ailene
 Suelo, Urieca
 Valebia, Giselle Anne

You might also like