1 / 19

groovy-interview-questions-ppt

Top 16 Groovy Interview Questions 1) What is Groovy? 2) Who designed the Groovy? 3) What is the stable version of Groovy? 4) Why we should use Groovy? 5) What are the features of Groovy? 6) What are the limitations of Groovy? 7) How can we write a simple program?

Himaani
Download Presentation

groovy-interview-questions-ppt

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. GROOVY INTERVIEW QUESTIONS JAVATPOINT www.javatpoint.com

  2. INTRODUCTION Apache Groovy Tutorial is an object-oriented programming language. It is used for Java platform. It is static as well as a dynamic language. Groovy has features similar to Python, Ruby, Perl, and Smalltalk. Groovy can be used both as a programming language and as a scripting language for the Java Platform

  3. 1) WHAT IS GROOVY? Groovy is an object-oriented programming language. It is based on the Java platform. It can also be used as the scripting language.

  4. 2) WHO DESIGNED THE GROOVY? James Strachan designed the Groovy.

  5. 3) WHAT IS THE STABLE VERSION OF GROOVY? The stable version of Groovy is 2.4.

  6. 4) WHY WE SHOULD USE GROOVY? • We should use Groovy because of the following advantages. • It provides easy syntax. • It has a lot of java libraries. • It is easy to integrate. • It is object-oriented. • It provides reusable code etc.

  7. 5) WHAT ARE THE FEATURES OF GROOVY? • Groovy features are listed below: • It supports operator overloading. • We can use existing Java libraries. • It supports various markup languages such as XML and HTML. • It supports for regular expressions

  8. 6) WHAT ARE THE LIMITATIONS OF GROOVY? • The following limitations of Groovy are: • The process of Groovy is slower. • It needs lots of memory • It requires Java knowledge • Getting used to New Syntax, closures, and default typing takes some time.

  9. 7) HOW CAN WE WRITE A SIMPLE PROGRAM? THE FOLLOWING PROGRAM IS SIMPLE: EXAMPLE: class Example { static void main(String[] args) { println('Hello World'); } }

  10. 8) WHAT IS GROOVYSH? Groovysh is a command-line application. It enables access to evaluate

  11. 9) WHAT ARE THE TYPES OF COMMENT USED IN GROOVY? There are two types of comments used in Groovy: Via single comment ( // ) Via multi comment ( /* ....*/)

  12. 10) WHAT ARE THE STEPS TO DECLARE STRING IN GROOVY? • In Groovy, the following steps are to declare a string. • The string is closed with single and double quotes. • It contains Groovy Expressions noted in ${} • Square bracket syntax may be applied like charAt(i)

  13. 11) WHAT ARE THE OPERATORS OF GROOVY? • The operators of Groovy are listed below: • Arithmetic operators • Relational operatorss • Logical operators • Bitwise operators • Assignment operators

  14. 12) WHAT IS MULTI-METHODS IN GROOVY? In Groovy, the methods that will be invoked are chosen at runtime, called runtime dispatch or multi-methods.

  15. 13) How can we initialize the Array? We can initialize the array by using the given below code. int[] array = [1,2,3]

  16. 14) WHAT ARE CLOSURES IN GROOVY? In Groovy, Closures is an open anonymous block of code that can take arguments. It returns a value and is assigned to a variable. Syntax: { [closureParameters -> ] statements }

  17. 15) HOW CAN WE RETRIEVE A SINGLE VALUE FROM THE DATABASE IN GROOVY? In Groovy, we can retrieve a single value from database by using given steps: row = sql.firstRow (‘select columnA, column from tableName’) println “Row: columnA = and column = ”

  18. 16) How to include a Groovy script into another groovy? The following code includes a Groovy script into another Groovy. Evaluate(new file(“../tools/Tools.groovy”))

  19. Thank you! www.tutorialandexample.com

More Related