RosettaCodeData/Task/Copy-a-string/Groovy/copy-a-string-1.groovy

4 lines
301 B
Groovy

def string = 'Scooby-doo-bee-doo' // assigns string object to a variable reference
def stringRef = string // assigns another variable reference to the same object
def stringCopy = new String(string) // copies string value into a new object, and assigns to a third variable reference