Skip to content

Instantly share code, notes, and snippets.

View PragmaticCoding's full-sized avatar

Dave Barrett PragmaticCoding

View GitHub Profile
@PragmaticCoding
PragmaticCoding / gist:34b03c5530a07313dca2f4c27b4c5785
Last active January 13, 2022 07:08
Kotlin Property with Overriden Getter and Setter
class KotlinClass() {
public var nickName: String = ""
set(value) {
field = value
println("in the setter")
}
get() {
println("in the getter")
return field
}
@PragmaticCoding
PragmaticCoding / gist:e7e3c38f85227842558e3ebc79f6c9ff
Last active January 13, 2022 07:09
Kotlin Property Implementation and Assignment
class KotlinClass() {
public var nickName: String = ""
}
fun main(args: Array<String>) {
val testClass = KotlinClass()
testClass.nickName = "Shorty"
println("Nickname: $testclass.nickName")
}
private final StringProperty firstName = new SimpleStringProperty("Alloysius");
public String getFirstName() {
return firstName.get();
}
public StringProperty firstNameProperty() {
return firstName;
}