I run groovysh
, and type the following code:
groovy:000> String s = "Hello"
===> Hello
groovy:000> s
ERROR groovy.lang.MissingPropertyException:
No such property: s for class: groovysh_evaluate
at groovysh_evaluate.run (groovysh_evaluate:2)
...
groovy:000>
How to access the s
here?
(If I change String s = "Hello"
to s = "Hello"
, I can access it. But I want to know how to access it in the example)
UPDATE
I want to use String s = "Hello"
to define a variable because I want to declare the type of it. For example, if I write:
Date date = []
The date will be a java.util.Date
. But if I write:
date = []
It will be a ArrayList
.
s
fromString s = ...
ingroovysh
, right? – Hern