开发者

Why some methods are not compiled in Groovy?

开发者 https://www.devze.com 2023-02-13 15:54 出处:网络
Why method A is not compiled while methods B and C are 开发者_开发问答ok? class A { methodA() { }

Why method A is not compiled while methods B and C are 开发者_开发问答ok?

class A {

  methodA() {

  }

  void methodB() {


  }

  static methodC() {


  }

}


You need to use the "def" modifier in groovy if you are not declaring a type for the method:

class A {
    def methodA() {
    }
}

should work.

0

精彩评论

暂无评论...
验证码 换一张
取 消