There is a very insignificant difference (actually insignificant, we are talking about micro-optimization here), since the string should be stored in a local variable that takes this extra bit of memory on the stack stack of the corresponding method. While the constants are actually stored in a constant pool and shared. With probable JVM optimization based on the number of calls, this will not make any difference.
Note that the bytecode will be the same if the variables were final or effectively final (assigned only once), as in this case they are considered as constants.
manouti
source share