Skip to content

Instantly share code, notes, and snippets.

@arkilis
Created November 15, 2017 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arkilis/2a083e984abde6a43192fa59b3899a8a to your computer and use it in GitHub Desktop.
Save arkilis/2a083e984abde6a43192fa59b3899a8a to your computer and use it in GitHub Desktop.
static_var_method.kt
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