title: Utils class in Kotlin
body: <p>In Java, we can create an utilities class like this:</p>
  
  <pre><code>final class Utils {
      public static boolean foo() {
          return false;
      }
  }
  </code></pre>
  
  <p>But how to do this in Kotlin? </p>
  
  <hr>
  
  <p>I try using functions inside <code>object</code>:</p>
  
  <pre><code>object Utils {
      fun foo(): Boolean {
          return false
      }
  }
  </code></pre>
  
  <p>But when call this method from Java code it need to add <code>INSTANCE</code>. Ex: <code>Utils.INSTANCE.foo()</code>.</p>
  
  <hr>
  
  <p>Then I change to declare it as top-level function (without <code>class</code> or <code>object</code>):</p>
  
  <pre><code>@file:JvmName("Utils")
  @file:JvmMultifileClass
  
  fun foo(): Boolean {
      return true
  }
  </code></pre>
  
  <p>Then I can call <code>Utils.foo()</code> from Java code. But from Kotlin code I got <code>Unresolved reference</code> compiler error. It only allow be to use <code>foo()</code> function directly (without <code>Utils</code> prefix).</p>
  
  <hr>
  
  <p>So what is the best approach for declaring utils class in Kotlin?</p>