scala是一门函数式的面向对象的语言,它运行在java虚拟机上。 eg1、 示例代码: scala>var helloWorld = "hello" + " world" println(helloWorld) scala>val again = " again" helloWorld = helloWorld + again println(helloWorld) 输出: hello world hello world again eg2、定义函数 def 示例代码: def square(a: Int) = a * a def squareWithBlock(a: Int) = { a * a} val squareVal = (a: Int) => a * a (这里是将Int整数a映射为a*a的函数)
SCALA的例子详解
最新推荐文章于 2020-07-27 05:59:27 发布