user840502 user840502 - 1 year ago 80
Java Question

What is Scala's equivalent of java char[]?

In Java class i have an abstract method characters(char[] in), as we can see it takes char[] as argument, I want to implement this class in my Scala but not able to find a correct way to write signature of characters in SCALA. I have tried this:

override def characters(ch: Array[Char], start: Integer, length: Integer)

But this signature does not match with characters method declared in java class. Please suggest.

Many Thanks

Answer Source

It's just Array[Char]. There is no need for additional start and length parameters.

And if there are start and length parameters in the original Java signature (but you're not showing them), then I bet they are ints, and so in Scala they should be Ints, not Integers.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download