This question already has an answer here:The Test class has:But a book that I am reading says the above Test class is mutable because:
I understand that annotations are immutable, however, arrays in Java are by themselves not immutable. After running a test I notice that the array returned from an annotation parameter can be mutated but it does not effect the source array:
Which one is the recommended approach:orThe latter saves on object creation, but is it worth the effort?
Should we synchronize on writing strings? Since string is immutable we will never get inconsistent state between write and read from the 2 different threads, right?