Java: Byte (class) vs byte (primitive)

A Byte is a class, or a reference type, defined in the standard library. It stores a reference to an object containing a value (a “box”).

A byte on the other hand, is a primitive type and part of the language itself. It stores an actual value.

We say that Byte is the wrapper type for byte, and objects of type Byte are boxed values.

Continue reading here:

Java: Primitives vs Objects and References
Java: Wrapper Types

Comments

Be the first to comment!