初始化和单利模式的实现
This commit is contained in:
13
demo1/InitAndSingleton.ky
Normal file
13
demo1/InitAndSingleton.ky
Normal file
@@ -0,0 +1,13 @@
|
||||
class InitAndSingleton{
|
||||
//初始化
|
||||
init{
|
||||
println("init")
|
||||
}
|
||||
//定义静态方法
|
||||
companion object{
|
||||
//方法实现
|
||||
fun function(){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user