Groovy web console

subscribe to the feed Subscribe
to this
site

Singleton

Published 8 years ago by Filirom1 with tags Singleton
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
@Singleton class Personn {

  String name

  int age
}

def p = Personn.instance;

p.name = "Romain"
p.age = 25

assert p == Personn.instance;