Re: ERROR: exceded the 65,535 byte limit
Spirit wrote:
public class MainApplication extends WebApplication {
private List<C> cheeses = new ArrayList<C>();
cheeses.add (new
C("BBTAA","001","","","","","","","","","","Portafotografia
argento","","","","","","","","","19.00","","","1000","ard","verif","","","","","","0"));
The last line (cheeses.add(...), give me this errors:
Multiple markers at this line
- Syntax error on token "add", = expected after this token
- Syntax error on token(s), misplaced construct(s)
Aeris wrote:
"add()" is not a static method, so you can't call it outside another
method. Try instead:
You can't call any method except 'static void main(String [])' from outside
another method. Being static or not is not relevant.
public class MainApplication extends WebApplication {
private List<C> cheeses = new ArrayList<C>() {
{
this.add(new C(???));
Use of 'this.' to qualify a method is pointless and also contrary to the
spirit of object orientation.
this.add(new C(???));
this.add(new C(???));
this.add(new C(???));
}
};
}
This is a very unusual idiom, to declare a subclass of 'ArrayList' and fill it
within the subclass initializer. The idiom will break on 'final' classes or
those with private constructors. It's also rather advanced to present to
someone who is clearly struggling with the very basics of Java.
What's wrong with filling the 'ArrayList' (or whatever), not a subtype, in the
constructor or an 'init()' method of 'MainApplication'?
--
Lew