Datatypes - Group Work

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 14

Definition of data type

 In software programming, data types refers to the type of values a variable has and what type of mathematical, relational
or logical operations can be applied.

Data types

primitive Non
primitive

boolean numeric

String arrays
Continuation of chart

character

char

integer Floating point


Continuation of chart

byte float
doubl
short
e
int

long
Types of data types
• INTEGER –IT USUALLY REPRESENTS WHOLE NUMBERS IN PROGRAMMING
• CHARACTER –IN CODING, ALPHABET LETTERS
• DATE – THIS TYPE STORES A CALENDAR DATE WITH OTHER PROGRAMMING
INFORMATION
• FLOATING POINT
• LONG
• SHORT STRING
• BOOLEAN
Primitive and non-primitive data types

 Primitive data types are basic most basic data types available within a language. i.e Java
language
 There are 8; boolen , byte ,char , short , int ,long ,float and double

 Non primitive data types are also called reference types because they refer to objects. i.e
class , string , array , interface
Differences between primitive and non-primitive data
types

 Primitive types are predefined in Java whilst non primitives are created by the
programmer
 A primitive type has always a value while non primitive type can be null
 A primitive type starts with a lower case letter whilst non primitive with an uppercase
letter
Boolen in primitive data type

 The boolean data type has only two possible values: true or false.
 It is used for simple flags that track true or false conditions. This data also represents one
bit of information, but its “size” isn’t something that is precisely defined.
Numeric data types in primitive data

 Numeric primitives: short , int , long , float ,and double


 These primitive data types holds only numeric values. Operations associated with such
data types are those of simple arithmetic or of comparisons
Character in numeric data type

 Numeric character data is stored as a character string. Before it can be used in arithmetic
computations, it must be converted to either decimal fixed point or to decimal floating
fixed point
CHAR data type in character

 The CHAR data type stores any string of letters, numbers, and symbols. It can store
single-byte and multi-bytes
 The char data types is a single 16=bit Unicode character
Integer

 The integer is a data type which basically represents whole numbers.an integer in the context of computer
programming is a data type used to represent numbers that do not have fractional values. The integer data type
applies to positive and negative numeric values that have no decimal point and punctuations such as commas and
dollar
 Integers can be in bytes, shorts, long, and short
 Byte data type: it has a range 0f -128 to 127 and it requires very little memory(only one byte).
 Short data type: it is the variable range which is more than a byte but less than int and it also requires more memory
in comparison to int.
 Int data type: is the most preferred type for numeric values
 Long data type: is less frequently used. It should only be used when the range of the numeric value is too high. It
requires the most memory(8bytes) in comparison to the other there data types
Floating point data type

 The floating type data type is a family of the data types that act alike and differ only in the
size of their domains.
 Data type float is sometimes called “single-precision floating point”. Data type double has
twice as many bits and is sometimes called double precision
 The float data type stores double precision floating point numbers with up to 17
significant digits.
Difference between float and double in the floating point data type

 The double represents much larger numbers than the float


 Both data types represents numbers with decimals but a float is 32bits in size whilst the
double is 64bits.
THE END

You might also like