update idea
This commit is contained in:
parent
aa0db58531
commit
00bf7c5676
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
39
src/main/kotlin/Demo1/InitAndSingleton.kt
Normal file
39
src/main/kotlin/Demo1/InitAndSingleton.kt
Normal file
@ -0,0 +1,39 @@
|
||||
package Demo1
|
||||
|
||||
class InitAndSingleton{
|
||||
//初始化
|
||||
init{
|
||||
println("init")
|
||||
}
|
||||
//带参构造方法
|
||||
constructor(data:String){
|
||||
println("data = ${data}")
|
||||
}
|
||||
//构造方法
|
||||
constructor(){
|
||||
println("not parma")
|
||||
}
|
||||
|
||||
//定义静态方法
|
||||
companion object{
|
||||
//方法实现
|
||||
fun function() {
|
||||
println("is Function")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun main() {
|
||||
InitAndSingleton()
|
||||
InitAndSingleton("uname")
|
||||
InitAndSingleton.function()
|
||||
|
||||
}
|
||||
/** out **
|
||||
init
|
||||
not parma
|
||||
init
|
||||
data = uname
|
||||
is Function
|
||||
**/
|
@ -1,13 +0,0 @@
|
||||
class InitAndSingleton{
|
||||
//初始化
|
||||
init{
|
||||
println("init")
|
||||
}
|
||||
//定义静态方法
|
||||
companion object{
|
||||
//方法实现
|
||||
fun function(){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user