Groovy web console

subscribe to the feed Subscribe
to this
site

this in static context

Published 2 years ago by Seagull
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
class A {
  static foo() {
    println(this) // java: non-static variable this cannot be referenced from a static context
    assert this == A.class
  }
}

A.foo()