I have following code:
String test = "Test" + System.currentTimeMillis();
When I print out this string several times it shows me exactly the same value.
System.out.println(test);
Thread.sleep(1000L);
System.out.println(test);
The result is following:
Test1591096276651
Test1591096276651
Why it didn't print result with difference in one second?
Is this JVM cache or something like that? How does variable initialization work? How does JVM know that it has been initialized and how to force it to reinitialize?
It would be great to read some documentation/specification to clarify why it works like it works.