Skip to content

Kotlin Q2 is wrong #4183

Closed
Closed
@westito

Description

https://github.com/Ebazhanov/linkedin-skill-assessments-quizzes/blob/main/kotlin/kotlin-quiz.md#q2-when-the-airplane-class-is-instantiated-it-displays-aircraft--null-not-aircraft--c130-why

Q2 is wrong. Abstract function can't be called (that's why it is abstract) so it can't return null. The answer closest to "A superclass is initialized before its subclass. Therefore, name has not been set before it is rendered", but this isn't really true either. If init{} in the Airplane class, then results will be the same.
The right answer is "init{} block runs before constructor". There is no reference linked and missing the instantiation line, C130 comes from nowhere.

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions