Java is not purely object oriented - what does it mean the primitive types are wrt?

When I look at the javadocs of the .java class it says:

/*The primitive Java types ({@code boolean},
 * {@code byte}, {@code char}, {@code short},
 * {@code int}, {@code long}, {@code float}, and
 * {@code double}), and the keyword {@code void} are also
 * represented as {@code Class} objects.
*/

      

I've always heard that primitive types in Java are not classes / objects, so Java is not purely object oriented. But the above JavaDoc confuses me.

0


source to share


1 answer


Don't confuse the term "represented" and mess up "type" and "value". Views are created by the Java Virtual Machine, they are not created for every primitive value(that would be autoboxing , although some instances are cached):

There are nine predefined class objects representing eight primitive types and are not valid. They are created by the Java Virtual Machine Machine and have the same names as the primitive types they represent: boolean, byte, char, short, int, long, float and double.

These objects are only accessible through the following public static final variables and are the only class objects for which this method returns true.



http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#isPrimitive%28%29

0


source







All Articles