Return to site

☕🆕 Primitive objects in Java

· java

You know how Java splits everything into primitives and reference types and you can only create the latter?

Get ready to have that worldview shattered! 👊💥💣🧨

Out of Project Valhalla comes Java Enhancement Proposal 401.

It proposes a distinction between 1️⃣ primitive class and 2️⃣ identity classes, both can be created by us developers.

1️⃣ Instance of the former, called primitive objects, will have no identity but the potential of the same performance and memory benefits as today's primitives. 😃

2️⃣ Instances of the latter, called identity objects, behave like today's class instances.

This JEP is not ❌ yet targeted 🎯 for a release, so we don't know which Java version will eventually contain 🔮.

#java #primitive #class