开发者

Why some methods are not compiled in Groovy?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜