SlideServe
Menu
Préférences
© SlideServe · v2026

Pemrograman Berorientasi Objek

darius-pope avatar
8 diapositives · 330 Views · Nov 20, 2014

Pemrograman Berorientasi Objek. Bab 5 – Package & Interface. Package. A package is a namespace that organizes a set of related classes and interfaces. Conceptually you can think of packages as being similar to different folders on your computer.

Pemrograman Berorientasi Objek - slide 1
01 / 8Pemrograman Berorientasi Objek
1 / 17

Télécharger la présentation

Pemrograman Berorientasi Objek
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Pemrograman Berorientasi Objek Bab 5 – Package & Interface

  2. Package • A package is a namespace that organizes a set of related classes and interfaces. • Conceptually you can think of packages as being similar to different folders on your computer. • You might keep HTML pages in one folder, images in another, and scripts or applications in yet another.

  3. Purpose • Organization. • Because software written in the programming language can be composed of hundreds or thousands of individual classes, it makes sense to keep things organized by placing related classes and interfaces into packages.

  4. Interface • is a class like constructs that only contains constants and abstract methods. • Purpose: define constants and abstract methods (that should be implemented by class) that can be used by several class. • So interface is like contract between class and interface.

  5. Constant and Method in Interface • Each constant in an interface is public static final by default, so we don’t need to write it. • Each method in an interface is public abstract by default.

  6. Interface Rule • Can’t be instantiate. • Can be used as data type. • Implemented not inherited by class. • Can be inherited by other interface. • A class can implement many interfaces not like inheritance (a class only inherits a class). • Each method in interface MUST be implemented by class that implement the interface.

  7. Warning • Since a class can inherit multiple interface, beware of name collision. • Name collision is same name (for constant or method) in different interface but implemented by a class. • Try to avoid it.

  8. How To? • <modifier> interface <Name> {} • Show sample!!