If I define a Scala class:
class X(i:Int) {
println (i)
}
How do I use this class in Java code?
[EDIT] Actually, my problem is slightly 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. Is it possible to do it 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 gives an error in Netbeans IDE but 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.
As of now I think the only solution is to ignore the NB errors.
Here is an image showing the exact error(s) I get:
