Correct declaration

Report a typo

Which of the classes below are declared correctly?

class Person(_firstName: String, _lastName: String, _age: String) {
    var firstName: String = _firstName
    var lastName: String = _lastName
    var age: Int = _age
}
class Route(startPoint: Int = 0, finishPoint: Int) {
    val distance = finishPoint - startPoint
}
class Worker(position: String, initialSalary: Int) {
    val position = position
    var salary = initialSalary
    init {
        if (position == "head of department") salary *= 2
    }
}
Select one or more options from the list
___

Create a free account to access the full topic