scala 代码

package com.smit

/**
 * Created by HongxueYu on 2014/9/26.
 */
object Timer {
    def oncePerSecond(callback:()=> Unit)
    {
        while(true){
          callback()
          Thread sleep 1000
        }
    }

    def timeFiles(): Unit ={
        println("time files like an arrow...")
    }




    def main(args: Array[String]) {
     // oncePerSecond(timeFiles);

      oncePerSecond(()=>println("time files like an arrow..."))
    }
}

 

 

你可能感兴趣的:(scala)