fork download
  1. public class Person {
  2. public String name;
  3. public Integer age;
  4.  
  5. // Constructor
  6. public Person(String name, Integer age) {
  7. this.name = name;
  8. this.age = age;
  9. }
  10.  
  11. public void display() {
  12. System.debug('Name: ' + name + ', Age: ' + age);
  13. }
  14. }
  15.  
  16. // Usage
  17. Person p = new Person('Alice', 25);
  18. p.display();
Success #stdin #stdout #stderr 0.01s 8940KB
stdin
Standard input is empty
stdout
Object: UndefinedObject error: did not understand #Person
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
UndefinedObject class(Object)>>doesNotUnderstand: #Person (SysExcept.st:1448)
UndefinedObject>>executeStatements (prog:1)
stderr
./prog:3: parse error, expected '}'