一般而言,介面中的方法沒有實際的程式碼,因此無法執行。若要執行,需要由非抽象的類別實現其介面,讓方法有實際的程式碼,才能執行[來源請求]。例如一種稱為Stack的介面需要支援兩種方法:push() and pop()。可以用不同的方式來實現,例如FastStack及GenericStack,第一個可能是快速的,其資料結構是固定長度的,第二個的資料結構其長度可以調整,不過速度較慢。
^Bill Venners. Leading-Edge Java: Design Principles from Design Patterns: Program to an interface, not an implementation - A Conversation with Erich Gamma, Part III. http://www.artima.com/index.jsp: artima developer. 2005-06-06 [2011-08-03]. (原始内容存档于2011-08-05). Once you depend on interfaces only, you're decoupled from the implementation. That means the implementation can vary, and that is a healthy dependency relationship. For example, for testing purposes you can replace a heavy database implementation with a lighter-weight mock implementation. Fortunately, with today's refactoring support you no longer have to come up with an interface up front. You can distill an interface from a concrete class once you have the full insights into a problem. The intended interface is just one 'extract interface' refactoring away. ...
^Patterson, D.A.; Hennessy, J.L. Computer Organization and Design: The Hardware/Software Interface 3rd. Elsevier. : 656. ISBN 9780080502571.