public class ScalaClassUser {
  public static void main(String[] args) {
    ScalaClass instance = new ScalaClass();
    
    //Passing a list
    java.util.List<String> names = new java.util.ArrayList<String>();
    names.add("Bob");
    names.add("Betty");
    instance.people(scala.collection.JavaConversions.asScalaBuffer(names));
        
    //passing a closure
    scala.Function0<String> block = new scala.runtime.AbstractFunction0<String>() {
      public String apply() {
        return "A block written in Java called from Scala";
      }
    };
    
    String result = instance.receiveBlock(block);
    System.out.println(result);
    
    //Using a singleton
    ASingleton.greet("Hello Scala...");
    
    //Using a companion object and its class
    instance.greet();
    ScalaClass$.MODULE$.greet();
    
    //Implemeting and using trait
    instance.receiveUtil(new MyUtil());
  }
}

class MyUtil implements Util {
  public void method1() {
    Util$class.method1(this);
  }
  
  public void method2() {
    System.out.println("method2...");
  }
}