Home / CSE MCQs / Groovy :: Discussion

Discussion :: Groovy

  1. You write a web application with groovlets. You need to get parameter of the request with name 'age' in your script. What is the best way to do this?
  2. A.
    def age = params.age ?: 0
    B.
    def age = params.age ? params.age : 0
    C.
    def age = params.name == 'age' ? params.age : "not found"
    D.
    def age = params.getAge

    View Answer

    Workspace

    Answer : Option D

    Explanation :



Be The First To Comment