class Foo{
int[] doop;
public Foo(){
this.doop={1,2,3,4,5};
}
}
I can't compile this, Java ME SDK gives me a bunch of "Illegal Start of Expression" errors. Why? How do I make this work?
Try this:
this.doop= new int[]{1,2,3,4,5};
You can't do this in constructor, because this syntax is allowed only for declaration with initialization. Fix to this:
class Foo{
int[] doop = new int[]{1,2,3,4,5};
public Foo(){
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With