Data types:
In java every variable has a type and every expression should have a type, every type is strictly defined. All variable assignments must be checked by the compiler for type compatibility hence java is considered as strongly typed language
byte à Capacity : 1 byte Range: -128 to +127
It is best suitable for file transfers via networks
short à capacity : 2 bytes Range: -215 to +215 -1
it is best suitable for 16 bit processors.
int à capacity : 4 bytes Range: -231 to +231 - 1
In C language int capacity varies platform to plat form. Hence C program results varies from platform to platform. Where as in JAVA int capacity is constant irrespective to platform.
long à capacity : 8 bytes Range: -263 to +263 -1
if any integer value excessed int value then we will go got long data type
float à Capacity : 4 bytes Range: -3.4e38 to +3.4e38 -1
if we wants to consider to 7 decimal of accuracy we will go for float
double à Capacity : 8 bytes Range: -1.7e308 to +1.7e308 -1
if we wants to consider to 15 decimal of accuracy we will go for double. Float and double types are best suitable for mediacl operators, satellite operations….
char à Capacity: 2 bytes. Range 0 to 65535 (no –ve values)
boolean à the capacity is virtual. No capacity and range
In c language 1 represents true 0 represents false. But in JAVA we have literals true & false
No comments:
Post a Comment