Let's find the differences between a companion object and an object declaration! Select all correct statements.
Computer scienceProgramming languagesKotlinObject-oriented programmingSpecial constructions / Special classes
Companion object
Companion object vs object declaration
Report a typo
Choose one or more options for each row
| Object declaration | Companion object | |
|---|---|---|
| Can be declared inside a class | ||
| Can be declared inside an object | ||
| The name can be omitted | ||
| Any number can be declared within a class |
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.