This is just out of curiosity and I guess I know the answer too but just wish to validate and know other viewpoints.
Compile time constants and variables tells that compile time constants are limited to only primitive types and Strings. Why so even if I declare a reference of some type A
as final
( final A aObj = new A();
)? Is it because classes are not loaded yet or something else? There are so many other immutable classes in JDK , Complete List of immutable JDK classes? , why those not included?