Scala 惰性加载
1 package com.atguigu.chapter04 2 3 object Test_Lazy { 4 def main(args: Array[String]): Unit = { 5 lazy val result : Int = sum(13,12) 6 println("1. 函数调用") 7 println("2. result = " + result) 8 } 9 def sum(a: Int ,b:Int):Int = { 10 println("3. sum调用!") 11 a+b 12 } 13 }
好看请赞,养成习惯:) 本文来自博客园,作者:靠谱杨, 转载请注明原文链接:https://www.cnblogs.com/rainbow-1/p/15817328.html
欢迎来我的51CTO博客主页踩一踩 我的51CTO博客
文章中的公众号名称可能有误,请统一搜索:靠谱杨的秘密基地