I created the below example in eclipse. I am following a tutorial, and it mentioned that I can use print(s1.captain)
to print the captain name for example. The tutorial wants to show that kotlin
automatically generate the setters
and getters
.
In my code the print statement does not print any thing
Main:
fun main(args : Array<String>) {
var s1 = Stronghold1("JJ",7)
print(s1.captain)
}
stronghold:
abstract class Stronghold(name: String, location: String)
stronghold1
class Stronghold1(captain: String, capacity: Int) : Stronghold("GerMachine", "Bonn")