RRB JE CBT2 : EXPERT
26 Jun

Data Types with Examples

Data TypeDescriptionExample
Integer (int)Whole numbers (positive, negative, or zero)10, -25, 0
Float (float)Decimal numbers (single precision)3.14, -7.25
Double (double)Decimal numbers with higher precision3.1415926535
Character (char)Single character'A', '7', '#'
StringSequence of characters"Hello", "BPSC"
Boolean (bool)Logical valuestrue, false
Byte8-bit integer127, -128
Short16-bit integer32000
LongLarge integer9876543210L
VoidNo value or no return typevoid main()

Primitive Data Types (Java/C/C++)

Data TypeExample
int25
float12.5f
double45.6789
char'K'
boolean/booltrue
byte100
short25000
long123456789L

Non-Primitive (Reference) Data Types

Data TypeExample
String"Computer"
Array{10,20,30}
ClassStudent s = new Student();
ObjectCar car = new Car();
InterfaceRunnable
EnumMONDAY, RED
Comments
* The email will not be published on the website.