If I create a Kotlin file MyTest.kt
package my.test
fun sayHello(): String = "Hello"
A class will be created MyTestKtand can be accessed from java as follows:
MyTestKt.sayHello()
MyTestKt myTestKt = new MyTestKt()
I would like to make this constructor private. Is it possible? If so, how?
I know what I can use objectto create a singleton, this is not my question. I know that I can create a class with companion objectinside, this is not my question either.
source
share