-
Notifications
You must be signed in to change notification settings - Fork 13.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kotlin Q2 is wrong #4183
Comments
Hello @westito , thank you for submitting an issue! 👍 We highly appreciate it if you work on it as well. |
I also had the same issue with this question. The correct answer should be Here is the long explanation:
When we create a new instance of Airplane, here are these steps which Kotlin does exactly underhood:
By the way, if you pass the snippet code in IntelliJ IDEA, you will get the warning message from IDEA |
Hi, despite this issue is closed I would also suggest to add this as reference for Q2. |
Done. |
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 theAirplane
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.The text was updated successfully, but these errors were encountered: