nerdexam
Salesforce

PDI · Question #111

A developer must implement a CheckPaymentProcessor class that provides check processing payment capabilities that adhere to what defined for payments in the PaymentProcessor interface. public…

The correct answer is B. Public class CheckPaymentProcessor implements PaymentProcessor { public void pay(Decimal. To implement an Apex interface, a class must use the implements keyword and provide a concrete definition for all methods declared in the interface.

Submitted by lucia.co· Apr 18, 2026Logic and Process Automation

Question

A developer must implement a CheckPaymentProcessor class that provides check processing payment capabilities that adhere to what defined for payments in the PaymentProcessor interface. public interface PaymentProcessor { void pay(Decimal amount); } Which is the correct implementation to use the PaymentProcessor interface class?

Options

  • APublic class CheckPaymentProcessor implements PaymentProcessor { public void pay(Decimal
  • BPublic class CheckPaymentProcessor implements PaymentProcessor { public void pay(Decimal
  • CPublic class CheckPaymentProcessor extends PaymentProcessor { public void pay(Decimal
  • DPublic class CheckPaymentProcessor extends PaymentProcessor { public void pay(Decimal

How the community answered

(47 responses)
  • A
    4% (2)
  • B
    91% (43)
  • C
    2% (1)
  • D
    2% (1)

Why each option

To implement an Apex interface, a class must use the `implements` keyword and provide a concrete definition for all methods declared in the interface.

APublic class CheckPaymentProcessor implements PaymentProcessor { public void pay(Decimal

While using `implements`, if the code snippet in the choice does not provide a concrete method body for the `pay` method, it would be an incomplete or incorrect implementation.

BPublic class CheckPaymentProcessor implements PaymentProcessor { public void pay(DecimalCorrect

A class implements an interface using the `implements` keyword, and then must provide a concrete implementation (with a method body) for all methods declared in the interface, such as `public void pay(Decimal amount) { /* implementation */ }`.

CPublic class CheckPaymentProcessor extends PaymentProcessor { public void pay(Decimal

The `extends` keyword is used for class inheritance, not for implementing interfaces in Apex.

DPublic class CheckPaymentProcessor extends PaymentProcessor { public void pay(Decimal

The `extends` keyword is used for class inheritance, not for implementing interfaces in Apex.

Concept tested: Apex interface implementation syntax

Source: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_interfaces.htm

Topics

#Apex Classes#Interfaces#Object-Oriented Programming#Apex Syntax

Community Discussion

No community discussion yet for this question.

Full PDI Practice