Sei sulla pagina 1di 1

Since the Messages interface offers a superset of the functionality available wi th the Constants interface, why would one

ever prefer to use Constants? Does Con stants offer any benefit over Messages when parameter substitution isn't needed? Messages is only about strings, while Constants can contain numbers, booleans, a rrays of strings, etc. Ah, right. But for non-parameterized strings, is there any reason to use Constan ts? Any compiler optimization that you don't get with Messages?

No; in this case, Messages or Constants will produce the exact same code: the co nstant string is inlined, and then possibly "interned" (i.e. moved to a global c onstant) by the compiler; and the Constants or Messages generated class is compl etely compiled out.

Potrebbero piacerti anche