Skip to content

Instantly share code, notes, and snippets.

@sagarpatel288
Last active June 17, 2020 00:36
Show Gist options
  • Save sagarpatel288/f3b5957d81bef9c4d3a51fdacfbc2d0d to your computer and use it in GitHub Desktop.
Save sagarpatel288/f3b5957d81bef9c4d3a51fdacfbc2d0d to your computer and use it in GitHub Desktop.
Access java static like variable defined inside of object declaration
/**
* 6/16/2020
* Accessing java static like members defined inside of an object declaration
* @author srdpatel
* @since 1.0
*/
fun main() {
//region Accessing members of an object declaration
println(StaticInObjectDeclaration.staticExample + " " + StaticInObjectDeclaration.jvmStaticExample)
println(StaticInObjectDeclaration.staticMethod() + " " + StaticInObjectDeclaration.jvmStaticMethod())
//endregion
}
class CallingClass {
//region Accessing variables defined inside an object declaration
var refStaticInObjDeclaration = StaticInObjectDeclaration.staticExample
var refJvmStaticInObjDeclaration = StaticInObjectDeclaration.jvmStaticExample
//endregion
//region Accessing methods defined inside an object declaration
var refStaticMethodInObjDeclaration = StaticInObjectDeclaration.staticMethod()
var refJvmStaticMethodInObjDeclaration = StaticInObjectDeclaration.jvmStaticMethod()
//endregion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment