Groovy web console

subscribe to the feed Subscribe
to this
site

constructor fun

Published 2 weeks ago by jkh
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
class Test {
  String a
  int b
  String c

  public Test() {
  }

  public Test(String a, int b, String c) {
    this.a = a
    this.b = b
    this.c = c
  }

  void print() {
    println(this.a + this.b + this.c)
  }
}

//d0 = [a: "that", b: 4, c: "no"]

def t1 = new Test( [a: "that", b: 4, c: "no", d:"lol"])
t1.print()