JGF1 (322) [Avatar] Offline
#1
You state you cannot assign a number to type String on the preceeding page. Then proceed to do just that! What's the score here?
I thought Strings in Groovy had to be quoted. It looks more like BigDecimal as described in table 3.2/P59

Is P177 wrong?
Quote: "you cannoot assign a number to a reference of type String or vice versa".

If code is right:
final static String PI = 3.14
it would infer to me literal 3.14 gets converted to BigDecimal per table 3.2. Maybe then a toString() method gets called and assigns it to String?

Which is correct?
I'd assume you can't assign a String to a number, but a number can be assigned to a String from this.
But it contradicts your initial statement!