If I define a Scala class:
class X(i:Int) {
println (i)
}
How to use this class in java code?
[EDIT] In fact, my problem is a little more complicated
I have an abstract class
abstract class X(i:Int) {
println (i)
def hello(s:String):Unit
}
I need to use this in Java code. Can this be done easily?
[EDIT2] Consider the following code
object B {
case class C(i:Int)
}
abstract class X(i:Int) {
println (i)
def hello(a:B.C):Unit
}
In this case, the following java code throws an error in the Netbeans IDE, but it builds fine:
public class Y extends X {
public void hello(B.C c) {
System.out.println("here");
}
public Y(int i) {
super(i);
}
}
The error I get is:
hello(B.C) in Y cannot override hello(B.C) in X; overridden method is static, final
Netbeans 6.8, Scala 2.8.
At the moment, I believe that the only solution is to ignore NB errors.
Here is the image showing the exact error (s) I get:

Jus12 source
share