We can create literals in Groovy using single quotes—like ’hello’. In Java, ’a’ is a char, while "a" is a String. Groovy makes no such distinction; both of these are instances of String in Groovy. If we want to explicitly create a character, we simply type ’a’ as char. Of course, Groovy may implicitly create Character objects if any method calls demand it.
Groovy is also flexible about what we can put into a literal. For example, we can have double quotes in our string if we want:
println 'He said, "That is Groovy"'
Groovy handled that fairly well, as we can see in the output:
He said, "That is Groovy"
Let’s examine the type of the object that was created using the single quotes: ...