Created
November 15, 2017 20:39
-
-
Save arkilis/2a083e984abde6a43192fa59b3899a8a to your computer and use it in GitHub Desktop.
static_var_method.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nterface Factory<T> { | |
fun create(): T | |
} | |
class Key(val value: Int) { | |
companion object: Factory<Key> { | |
// static variable 1: | |
@JvmField | |
val staticVar = "this is info" | |
// static variable 1: | |
const val staticVar = "this is info" | |
// static method | |
@JvmStatic | |
override fun create(): Key = Key(12) | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment