Unlike in the Java programming language, it is not mandatory to have semicolons after the end of every statement, It is optional.
class Example { static void main(String[] args) { def x = 5 println('Hello World'); } }
If you execute the above program, both statements in the main method don’t generate any error.