Bad String abuse

In this Java Puzzler, it has some serious abuse of Strings, but what is going on?


  1. Thank you for the puzzle!

    Unfortunately, I couldn't clearly understand the source of such behaviour. I suppose the the reason is in a way how String Constant Pool selects constants on a base of hashCode() execution. But I'm not sure.

    So will wait for your solution :)

    P.S. could you, please, allow comments and RSS subscription on your GitHub blog?

    1. I read that internally String Constant Pool uses Hashtable for storing strings. So looks like equal hashCode() values isn't enough for getting puzzle effect. Also, at the first sight, external synchs on "bb" and "cC" really work on String instance wrappers not on internally char[] arrays...

      So the puzzle is really puzzle :)


Post a Comment

Popular posts from this blog

Java is Very Fast, If You Don’t Create Many Objects

System wide unique nanosecond timestamps

Comparing Approaches to Durability in Low Latency Messaging Queues