nerdexam
Salesforce

PDI · Question #129

A lead developer creates an Apex interface called "Laptop". Consider the following code snippet: How can a developer use the Laptop Interface within the Silvertaptop class?

The correct answer is D. public class Silverlaptop implements Laptop. To use an Apex interface like Laptop within a class such as SilverLaptop, the class must explicitly implement that interface.

Submitted by obi.ng· Apr 18, 2026Logic and Process Automation

Question

A lead developer creates an Apex interface called "Laptop". Consider the following code snippet:

How can a developer use the Laptop Interface within the Silvertaptop class?

Options

  • A@Extends(class=Laptop'')
  • Bpublic calss SilverLaptop extends Laptop
  • C@Interface (class=''Laptop'')
  • Dpublic class Silverlaptop implements Laptop

How the community answered

(18 responses)
  • A
    6% (1)
  • B
    6% (1)
  • D
    89% (16)

Why each option

To use an Apex interface like `Laptop` within a class such as `SilverLaptop`, the class must explicitly `implement` that interface.

A@Extends(class=Laptop'')

`@Extends` is not a valid Apex annotation or keyword for implementing interfaces.

Bpublic calss SilverLaptop extends Laptop

The `extends` keyword is used for inheritance between classes (a class extending another class), not for implementing an interface.

C@Interface (class=''Laptop'')

`@Interface` is not a valid Apex annotation or keyword for implementing interfaces; it would be used to define an interface, not implement it.

Dpublic class Silverlaptop implements LaptopCorrect

In Apex, a class uses the `implements` keyword to indicate that it provides an implementation for all the methods declared in an interface. This establishes the contract that `SilverLaptop` will adhere to the `Laptop` interface's defined methods.

Concept tested: Apex interface implementation syntax

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

Topics

#Apex#Object-Oriented Programming (OOP)#Class Inheritance#extends keyword

Community Discussion

No community discussion yet for this question.

Full PDI Practice