You need to sign in to do that
Don't have an account?
Edward chan
Unable to declare it
Hi,
Here are the codes I have:
1 public class StoreFront {
2 public PageReference shop() {
3 public String message;
4 message = 'You bought: ';
5 for (DisplayMerchandise p: products) {
6 if (p.count > 0) {
7 message += p.merchandise.name + ' (' + p.count + ') ';
8 }
9 }
10 return null;
11 }
...
and here is the error
Error: Compile Error: Illegal modifier on local variable at line 3 column 15
why?
shop() method has a varibale message which is local and your code uses public identifier.
Please update the variable declaration as "String message;" i.e. remove 'public'
Regards,
-P
Hi Edward Chan,
Under the public method you are declaring public member. Thats why it throwing error.
Replace you code with following.
Hi all, I have a weird note to add to this thread.
I declared this in a trigger body before the winter 14 upgrade:
and it saved fine, compiled and the trigger worked perfectly.
Now that I am revisiting the trigger to make some edits I get an error for Illegal modifier, which I understand, I just missed it when I was coding originally. I removed the 'private' and it saved again. My question is why did it let me save in the first place? Must be an api version thing.