To store numaric values in variables declare variables with one of the numaric data types Integer ,Long,Double and Decimal.
Integer:
A 32-bit number that doesn't include a decimal point .
Integers have a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647
Ex:Integer i=1;
Double:
Anumber that includes a deciamal point .
Decimal is an orbitary precision numbers .Currency fields are automatically assigned precission numbers. Currency fields are automatically assigned the type deciamal
Ex: Double d = 3.14159;
Long :
A 64 bit number that doesn't include a decimal point longs have a minimum value of -263 and maximum value of 263-1
Ex: Long l = 2147483648l;
Decimal : A number that includes a decimal point.
decimal is an orbitary precision number
Currency fields are automatically assigned the type deciaml.
Deciaml d = 19.23;
Null values :
If we declare a varible and don't initilize it with a value , it will be null. Null means the absense of a value. We can also assign a null to varivle declare with a primitive type.
Both of these statements results in a varible set to null
Boolean x = null;
Decimal d;
Integer:
A 32-bit number that doesn't include a decimal point .
Integers have a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647
Ex:Integer i=1;
Double:
Anumber that includes a deciamal point .
Decimal is an orbitary precision numbers .Currency fields are automatically assigned precission numbers. Currency fields are automatically assigned the type deciamal
Ex: Double d = 3.14159;
Long :
A 64 bit number that doesn't include a decimal point longs have a minimum value of -263 and maximum value of 263-1
Ex: Long l = 2147483648l;
Decimal : A number that includes a decimal point.
decimal is an orbitary precision number
Currency fields are automatically assigned the type deciaml.
Deciaml d = 19.23;
Null values :
If we declare a varible and don't initilize it with a value , it will be null. Null means the absense of a value. We can also assign a null to varivle declare with a primitive type.
Both of these statements results in a varible set to null
Boolean x = null;
Decimal d;
No comments:
Post a Comment