Error on adding object to arrayList
Hello sirs,
I have problem with adding element of type object to an arrayList.
This is the error Iam getting
symbol : method add(syntaxtree.Exp)
location:class java.lang.Object
{yyrv=yysv[yysp-1].add(((Exp)yysv[yysp-2])); yyrv = yysv[yysp-1];}
[/code
The code is
[code]
VarDecList:VarDec VarDecRest{$$=$2.add($1); $$ =$2;}
;
VarDecRest:';'VarDec{$$=$2;}|{$$=new VarDecList();}
;
Iam really stacked can anyone help me.
I will appreciate for your help
> Hello sirs,
> I have problem with adding element of type object to
> an arrayList.
> This is the error Iam getting
> [code]
> symbol : method add(syntaxtree.Exp)
> location: class java.lang.Object
> {yyrv=yysv[yysp-1].add(((Exp)yysv[yysp-2]));
> yyrv = yysv[yysp-1];}
> /code
> The code is
>
> e]
> VarDecList:VarDec VarDecRest
>
> $$=$2.add($1); $$ =$2;}
>
> $$=$2;}
>
>{$$=new VarDecList();}
> e]
>
> Iam really stacked can anyone help me.
> I will appreciate for your help
This is Java code?
Try reposting with the [code] tags in the correct spot - use the preview button to view before posting.
> Thanks jbish .
> Ok,it is jacc code.sorry for not making it clear.
> But Just want to your help on adding element on an
> arrayList.
> cause used the add method but getting the mentioned
> error.
> Thanks again
Could you post the exact error message again - or am I just not seeing it (don't know jacc).