What will happen when you try to build and run this code snippet?kotlinclass SpecialFunction : () -> Unit { override fun invoke() { println('Invoked from an instance.') }}fun main() { try { SpecialFunction()() } catch (ex: Exception) { println('An error occurred') }}

🎲 Try a Random Question  |  Total Questions in Quiz: 83  |  🧠 Study this quiz with Flashcards
This question is part of a full practice quiz:
Kotlin Quiz — practice the complete quiz, review flashcards, or try a random question.

Kotlin MCQs For LinkedIn Skill Assessments.


What will happen when you try to build and run this code snippet?<br>kotlin<br>class SpecialFunction : () -> Unit {<br> override fun invoke() {<br> println('Invoked from an instance.')<br> }<br>}<br>fun main() {<br> try { SpecialFunction()() }<br> catch (ex: Exception) { println('An error occurred') }<br>}<br>