If I write:
def getShort(b: Array[Byte]): Short
in Scala, I get a primitive short in Java, which is fine. But if I write:
def getChar(b: Array[Byte]): Char
I get a scala.Char object, which is NOT fine. And if I write:
def getChar(b: Array[Byte]): Character
I get a java.lang.Character, which ISN’T fine either.
If Scala “Char” isn’t Java “char”, and Scala “Character” isn’t Java “char”, then what is left?
You’re mistaken;
Charis the Java primitive char. Observe:One needs to have tools.jar on the classpath for
:javapto work, by the way. It’s included with the Sun/Oracle JVMs.