– Building blocks of the Java Programming language
– In Java, everything is an Object – except primitives
– Primitives exist because they are more efficient than their Object counterparts, but they are less flexible

Examples:

Primitive Object Counterpart
int Integer
double Double
float Float
char Character
boolean Boolean

– Primitives declares as instance variables get default values:

Primitive Default Value
int 0
double 0.0d
float 0.0f
char u000
boolean false

– The Primitives’ Object Counterparts don’t get a default value, they are just null if they aren’t assigned a value

Homework

Please go through this useful document from Oracle (the owners of Java) and read up on the finer points of Java Primitives, <sarcasm>it’s just captivating reading</sarcasm>:

http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

Free Java Beginners Course

Start learning how to code today with our free beginners course. Learn more.

Thank you for your message. It has been sent.
There was an error trying to send your message. Please try again later.