读书人

scala 函数宣言使用返回值时要用=号

发布时间: 2012-10-27 10:42:26 作者: rapoo

scala 函数声明使用返回值时要用=号

class Operators{  def retString():String={//有返回值    return "hello world";  }  def echo(){//无返回值    println("hello world");  }  def echo(str:String){//带参数    println(str)  }  def echo(i:Int)(str:String){    print(i)    println(str)  }}


读书人网 >编程

热点推荐