title: Unable to call a scala object in a switch case in java
body: <p>I want to call an object written in Scala in a switch case block in java, but I get an error:</p>
  
  <pre><code>case expressions must be constant expressions
  </code></pre>
  
  <p>The object in scala is:</p>
  
  <pre><code>object Test {
     val A = "a"
     val B = "b"
  }
  </code></pre>
  
  <p>And in java I have the following code block:</p>
  
  <pre><code>String op = "a"
  switch(op) {
     case Test.A(): System.out.println("A"); break;
     case Test.B(): System.out.println("B"); break;
  }
  </code></pre>
  
  <p><code>Test.A</code> translated in java would be <code>public static final A</code>, so I don't have any idea why the compiler compains.</p>