fork download
  1. public class Addition //define class
  2. {
  3. public integer a=5; //define variables
  4. public integer b=4;
  5. public integer c;
  6. public integer add() //define function or method
  7. {
  8. c=a+b;
  9. system.debug('the result is '+c);
  10. return c;
  11. }
  12. }
Success #stdin #stdout #stderr 0.01s 9028KB
stdin
Standard input is empty
stdout
Object: UndefinedObject error: did not understand #Addition
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
UndefinedObject class(Object)>>doesNotUnderstand: #Addition (SysExcept.st:1448)
UndefinedObject>>executeStatements (prog:1)
stderr
./prog:4: parse error, expected '}'