# getting-started

Jast Lai

10/22/2021, 6:57 AM
I have a question of Kotlin coding style. I usually put companion object on the top of class layout. Because it made me easy to find const value that I set in companion object. But suggest us to put companion object on bottom of class layout. I wonder why suggestion is like that. Dose it have any reason ?

Mustafa Ozhan

10/22/2021, 7:30 AM
yeap because inner class/objects should be bottom of the class, it is due to this, it seems not right to you probably you just have some constant values there, like Java’s
private static final x
but in kotlin you are wrapping it with and object called
companion object
so that’s the reason 🙂
if you have a kotlin file then you will be able to put your `const val`s on the top 🙂
💯 1
👍 1


10/22/2021, 3:30 PM
yes, no need to put them in a companion object unless that's how you want to expose it to other users