DevOps / Apache Groovy Interview questions
What are GStrings in Groovy?
A GString is Groovy's interpolated string type, written with double quotes, that lets you embed expressions directly inside the string using ${...} (or a simpler $variable shorthand for plain variable references).
Unlike a plain Java String, a GString is lazily evaluated - the embedded expression is only resolved to its current value when the GString is actually converted to a String, not necessarily at the moment it was written.
Single-quoted strings in Groovy remain plain, non-interpolated Java Strings, so choosing double versus single quotes is also a signal of whether interpolation is intended.
More Related questions...