Primitive Data Types in Java Programming
Previous | Home | Next |
Primitive Data Types in Java Programming are similar to c and c++.they include byte,int ,short,long,Boolean, char, float and double.
A variables data type determines the value it contain and the operation occurs on it.A variables data type determines the value it contain and the operation occurs on it.
Byte it takes 1 byte size and covers values from -128 to 127
int it takes 4 bytes and cast into numeric values only.it covers values from -2,147,483,648 to 2,147,483,647
Short it takes 2 bytes. it also cast into numeric values. it covers values from -32,768 to 32,767
long it takes 8 bytes it cast into numeric values.
Boolean it takes 1 byte ,it take values true and false only
char it takes 2 bytes, unsigned, Unicode, 0 to 65,535
float it takes 4 bytes ,it cast into decimal or fractional values
double it takes eight 8 bytes and cast into decimal values
boolean result = true;
char capitalB = 'B';
byte b = 110;
short s = 100;
int i = 500;
boolean result = true;
char capitalB = 'B';
byte b = 110;
short s = 100;
int i = 500;
Previous | Home | Next |