Wednesday 25 February 2015

Oracle Sales Cloud Groovy Tips and Tricks : Data Types

Data Types are the fundamentals for any programming language. Since groovy is a programming language for the Java platform, it is following java syntax. Since it is a scripting language, we can achieve more by writing less lines of codes.

In Java:-

Primitive Data Types:-

Data Type
Size
Range
Usage in Real world
byte
8-bit
minimum value of -128 and a maximum value of 127 (inclusive)
byte b= 127;
System.out.println(b); will print 127

short
16- bit
-32,768 and a maximum value of 32,767 (inclusive)

int
 32-bit 
-231 and a maximum value of 231-1

long
 64-bit
 -263 and a maximum value of 263-1

float
32-bit IEEE 754 floating point


double
64-bit IEEE 754 floating point


boolean
1-bit
The boolean data type has only two possible values: true and false

char
16-bit Unicode character
'\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive).



Data Type
Default Value
byte
0
short
0
int
long
 0L
float
0.0f
double
0.0d
boolean
false
char
'\u0000'






No comments:

Post a Comment