title: How to use System.in.readLine() in Groovy?
body: <p>I wrote a groovy script like this:</p>
  
  <pre><code>print "Please enter your name:"
  def name=System.in.readLine()
  println "My name is : ${name}"
  </code></pre>
  
  <p>But when I ran it ,I got an exception:  </p>
  
  <blockquote>
    <p>Exception thrown
    groovy.lang.MissingMethodException: No signature of method: java.io.BufferedInputStream.readLine() is applicable for argument types: () values: []
    Possible solutions: readLines(), readLines(java.lang.String), eachLine(groovy.lang.Closure), eachLine(java.lang.String, groovy.lang.Closure), eachLine(int, groovy.lang.Closure), eachLine(java.lang.String, int, groovy.lang.Closure)</p>
  </blockquote>
  
  <p>And I found System.in.readLines() did work, but that method read multiple lines.<br>
  Besides, the basic input function can only work in command line. In GroovyConsole,when I run the script, I can't input anything.<br>
  Any veteran can help me? Thanks a lot!</p>