Is the building block of the Java anonymous inner class thread-safe?

for example:

new ObjectXXX(){{
    setXXX(123);
}};

Thread safety depends on whether you have a synchronization lock, which has nothing to do with hiding anonymous classes!

Menu