Created
November 29, 2018 00:26
-
-
Save cassiozen/b28b8785dc9e78330a36caa1b9edf632 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 Monster(val name: String, val color: String, val numEyes: Int) { | |
fun speak(likes: String):String { | |
return "My name is $name and I like $likes" | |
} | |
} | |
var nhama = Monster("Nhama", "red", 1) | |
// Kotlin doesn't have a `new` keyword - you instantiate a class by calling it directly | |
nhama.speak("guacamole") | |
// "My name is Nhama and I like guacamole" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment