Created
October 18, 2016 09:19
-
-
Save mkovacek/285c329f0955390ba43f7a69ec391fe9 to your computer and use it in GitHub Desktop.
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
class Person(val firstName: String, val lastName: String){ | |
println("beginning of the constructor") | |
var age = 25 | |
def printInfo = println("Firstname: " + firstName + ", lastname: " + lastName + ", age: " + age) | |
printInfo | |
println("end of the constructor") | |
} | |
val person = new Person("Matija","Kovacek") | |
/* | |
beginning of the constructor | |
Firstname: Matija, lastname: Kovacek, age: 25 | |
end of the constructor | |
*/ | |
// getter | |
person.firstName | |
//setter | |
person.age = 30 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment