Java uses type erasure which are very cheap in compile time but you cannot do things like

   t = new T(); // T is a template parameter class
C++ uses reified generics which are heavy on compile time but allows the above.

That's why they're called generic parameters, not template parameters; the code is generic over all possible parameters, not templated for every possible parameter.

    > C++ uses reified generics
I was a C++ programmer for many years, but I never heard this claim. I asked Google AI and it disagees.

    > does c++ have reified generics?

    > C++ templates do not provide reified generics in the same sense as languages like C# or Java (to a limited extent). Reified generics mean that the type information of generic parameters is available and accessible at runtime.

Interesting I’d never picked up on this pedantic subtlety. I too thought reified meant what you could do at the call site not what you could do at runtime. Was my understanding wrong, or is Gemini hallucinating.

In any event, you have to use weird (I think “unsafe”) reflection tricks to get the type info back at runtime in Java. To the point where it makes you think it’s not supported by the language design but rather a clever accident that someone figured out how to abuse.