public interface Constants{
String TEST = 'test';
}
I am getting below error -
Error: Compile Error: expecting a left parentheses, found '=' at line 2 column 16
Can someone explain why am i getting this error?
I am getting below error -
Can someone explain why am i getting this error? |
|||||
|
|
Interfaces should have only method declarations. If you think you need member variables within this new type you're creating - you most likely want to make a class that you'll extend later on. Probably even an abstract class?
I fail to understand how someone might think he later needs to write Please don't name your classes or variables |
|||
|
|
|
You can't declare a constant in an interface, or for that matter implement any code other than method signatures (which you must then implement in a Class). An interface is a fairly generic term across programming languages. You can read about it in general here: http://en.wikipedia.org/wiki/Interface_(computing) Or, specifically in Apex here: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_interfaces.htm However, it looks like you might want an enum (or a class) though for what you're doing, you can read up on that here: http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_enums.htm Or if you simply want it as a class:
So you can access it elsewhere as:
|
|||
|
|