- 链接地址:https://blog.csdn.net/zjlzxc/article/details/112569473
- 链接标题:Scala方法形参中传入函数作为参数_scala 方法中的参数是函数-CSDN博客
- 所属网站:blog.csdn.net
- 被收藏次数:6974
文章浏览阅读2.3k次。在Scala中可以将函数作为参数传递到另一个方法中,代码如下:object FunctionTest { def main(args: Array[String]): Unit = { test(plus) } def test(fun: => Unit): Unit = { println("this is test run") fun } def plus() = { println("this is plus run") }_scala 方法中的参数是函数
版权声明:本文发布于特牛生活网 内容均来源于互联网 如有侵权联系删除