ApexSensei

All drills

Think in classes: Apex practice drills

Classes, constructors, methods, access modifiers, exceptions and enums.

10 drills · Beginner · Free to run

  1. Build a Case summary class (Beginner, 10 min)
    Write a small class, create separate Case summary objects, and call a method on each one.
  2. Build queue labels with parameters (Beginner, 10 min)
    Pass different owner names and Case counts into one reusable method.
  3. Return a value and record work (Beginner, 12 min)
    Contrast a method that returns a Lead action with a void method that changes state.
  4. Initialize an appointment plan (Beginner, 12 min)
    Use a constructor to set up an appointment plan and enforce a minimum length.
  5. Protect a support ticket subject (Beginner, 12 min)
    Keep ticket fields private and change them only through a public method that checks the input.
  6. Expose a read-only quote total (Intermediate, 15 min)
    Use Apex properties to protect a subtotal and work out a read-only total with tax.
  7. Overload a Case label method (Intermediate, 15 min)
    Give one method several parameter lists for normal, urgent, and aged Cases.
  8. Route Cases with an enum (Intermediate, 15 min)
    Model a fixed set of Case priorities, route each one with switch, and loop over them with values().
  9. Recover from division by zero (Intermediate, 15 min)
    Call a calculator inside try/catch, catch the divide-by-zero MathException, and keep going.
  10. Reject an invalid discount (Intermediate, 18 min)
    Throw a custom exception when a discount is outside 0 to 50 percent, and print its message.

Start practicing free