Friday, April 20, 2018

Class X (ICSE) Data types



CLASS - X (ICSE)

COMPUTER  APPLICATION



Data Types
®      A type identifies a set of values (and their representation in memory) and a set of operations that transform these values into other values of that set.
®     Java is strongly typed language.
®     Types of data types
Ø  Primitive type (or Intrinsic Data Type)
Ø  Non-Primitive type(Reference/Object or Composite Data Type)

Primitive Data Types
®     Once a primitive data type has been declared its type can never change, although in most cases its value can change.
®     These eight primitive type can be put into four groups
Data type
Default value
Default size
boolean
false
1 bit
char
‘\u0000’
2 byte
byte
0
1 byte
short
0
2 byte
int
0
4 byte
long
0L
8 byte
float
0.0f
4 byte
double
0.0d
8 byte

Data Type
Range 
boolean
Reserves 8 bits and only uses  bit
char
0(‘\u0000’) to 65,535(‘\uffff’)
byte
-128 to 127 ( -27 to 27-1)
short
(-215 to 215-1 )
int
(-231 to 231-1 )
long
 (-263 to 263-1 )
float
-3.4E+38 to  +3.4E+38
double
-1.7E+308 to +1.7E+308


Non-primitive Data Type
®     A reference data type is used to refer to an object.
®     A reference variable is declare to be of specific and that type can never be change.
®      class, arrays, interface etc.
®     Eg: String, Scanner, Random, int[], String[] etc
®     Reference variables store addresses

No comments:

Post a Comment