Found a super good question here on SO someone ask...
# announcements
private companion members are unavailable for
Copy code
class Foo {
    init {
        println(Foo.phello) // Works
        println(Foo.hello) // ERROR

    private companion object {
        val phello = "world"
        private val hello = "world"
Usefull for singleton cases
n sure? works for me
Oh wow yeah apparently it does work playground
so one potentially-interesting follow-up question is -- if I have private static state, should I have a public companion object with private fields, or a private companion object with "public" fields? and...that doesn't really matter too much, except that public companion objects are referenceable in Java as
or whatever, even if they're empty. on the other hand, if you're going to be adding public static state soon, it's easier to make the companion object public; otherwise you have to add private to all the now-public-but-should-be-private fields after making the companion object public