Skip to main content

Posts

Showing posts from January, 2020
Above is the code and output for the Hello World program. This program is executed very similarly in java. The print command is the one that is used in Java. One difference between Groovy and Java is the lack of parentheses. In Java, this line of code would have been println("Hello World!"). However, in Groovy it is simply println "Hello World. For this line of code,  a semi colon was not necessary. Semi colons are not used in Groovy to end a line of code.  The overall syntax for this program was similar to Java with a few exceptions. To define and assign a variable, the word def is used. An example would be: def name. Groovy also has assert statements which are similar to if statements  and booleans in Java. The assert statements are executed if the statement is true. If the statement is not true, then the code is not executed.

Groovy -Background Information

Groovy Background information Groovy is an object oriented language with java syntax that was invented by James Strachan. Groovy is a dynamic language that has static typing.  Groovy is a more compact language and does not need all of the elements that Java has. Certain elements in groovy such as static and dynamic typing are not included in Java. Even though Groovy is a dynamic language, it is an efficient language. Groovy was invented to simplify the java language and because of its similarity to Java, it is considered easy to learn. The creators of Groovy have said that it is not made to replace Java but to make it more accessible and simple. Groovy also allows for functional programming. Groovy is one of the top java virtual machine languages. Resources “Differences with Java.”  The Apache Groovy Programming Language - Differences with Java , groovy-lang.org/differences.html. Krill, Paul. “Groovy: The Road Map for the Popular JVM Language.”  ...