I have a piece of Scala code:
class A {
def main(args: Array[String])
}
Then a piece of Java code:
class B {
public static int test(final String... args) {
System.out.println("This is a test.");
// Use the arguments
...
}
}
What I want is to call B.test within A.main like below:
class A {
def main(args: Array[String]) = {
val result = B.test(args)
}
}
The above code won't work because the types do not match. If somebody could provide an elegant solution it would be highly appreciated.
Please only change the Scala part as the Java part will come from another lib. Thank you!
B.test(args:_*)should work.