DevOps / Apache Groovy Interview questions
List the main differences between Groovy and Java syntax?
Groovy makes semicolons, parentheses around method arguments (in many cases), and explicit return statements optional, so code can often be written more tersely than the equivalent Java without changing its meaning.
Groovy provides native syntax for lists and maps (like [1, 2, 3] and [key: 'value']) and adds operators Java lacks, such as the safe navigation operator ?., the Elvis operator ?:, and the spread operator *..
Typing is optional via def, == compares by value/equals rather than reference by default, and every class/method is public by default unless stated otherwise, all differing from Java's stricter, more verbose defaults.
More Related questions...