|
What are the Java data types |
|
|
Java has two groups of data types, primitive data types and object references.
Java Primitive Data Types
| Data Type | Purpose | Contents | Default Value* |
| boolean | Truth value | true or false | fales |
| char | Character | Unicode characters | \u0000 |
| byte | Signed integer | 8 bit two's complement | (byte) 0 |
| short | Signed integer | 16 bit two's complement | (short) 0 |
| int | Signed integer | 32 bit two's complement | 0 |
| long | Signed integer | 64 bit two's complement | 0L |
| float | Real number | 32 bit IEEE 754 floating point | 0.0f |
| double | Real number | 64 bit IEEE 754 floating point | 0.0d |
One way to remember the Java primitive data types is by using this mnemonic aid: Be Careful, Bears Shouldn't Ingest Large Furry Dogs.
Instance variables are assigned default values; local variables are not assigned default values.
Java object references are variables which hold references to objects. Unlike Java primitive data types which store actual data, object references store only a reference to the actual data object.
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.