Java Data Types The Java language contains the following primitive data types: Data type Description byte 8 bit signed value, value...

Java Data Types

09:30 PASSOVE INCOME 0 Comments

Java Data Types


The Java language contains the following primitive data types:
Data typeDescription
byte8 bit signed value, values from -128 to 127
short16 bit signed value, values from -32.768 to 32.767
char16 bit Unicode character
int32 bit signed value, values from -2.147.483.648 to 2.147.483.647
long64 bit signed value, values from -9.223.372.036.854.775.808 to 9.223.372.036.854.775.808
float32 bit floating point value
double64 bit floating point value
That these are primitive data types means that they are not objects. Classes and objects are explained later. The primitive types also come in versions that are objects, meaning you can call methods on them, like on any other object in Java.
Java also contains a few core data types which are objects. Here is a list of those types, including the object versions of the primitive types.
Data typeDescription
Byte8 bit signed value, values from -128 to 127
Short16 bit signed value, values from -32.768 to 32.767
Character16 bit Unicode character
Integer32 bit signed value, values from -2.147.483.648 to 2.147.483.647
Long64 bit signed value, values from -9.223.372.036.854.775.808 to 9.223.372.036.854.775.808
Float32 bit floating point value
Double64 bit floating point value
StringN byte Unicode string of textual data. Immutable
Notice how object types are spelled with a capital letter in the beginning of their name.
There are of course many other components you can use in the Java API, but the above mentioned data types are the core Java types.
You can also create your own more complex data types by creating custom classes. I will get back to how in a later text.

0 comments: