Groovy web console

subscribe to the feed Subscribe
to this
site

Overriding static methods

Published 1 month ago by Douglas with tags static override
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
trait X {
 abstract static void test()
}

class A implements X {
  static void test() { println "a" }
}

class B extends A {
  static void test() { println "b" }
}

A.test() // a
B.test() // b