SHOW:
|
|
- or go back to the newest paste.
| 1 | - | ['a','b', null, 'c'].each{ println "$it -> ${it?.toUpperCase()}" } |
| 1 | + | class AlbumDemo {
|
| 2 | // statically typed property | |
| 3 | String title | |
| 4 | ||
| 5 | // dynamically typed property | |
| 6 | def price | |
| 7 | ||
| 8 | def printAlbum() {
| |
| 9 | println title + ': ' + price | |
| 10 | } | |
| 11 | ||
| 12 | static void main(String[] args) {
| |
| 13 | def album = new AlbumDemo(title: 'Best Of 2010', price: 20.5) | |
| 14 | album.printAlbum() | |
| 15 | } | |
| 16 | } |