





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






Object-Oriented Programming (OOP)
View software as a collection of objects (entities)
To be discussed later in the semester
Abstraction Encapsulation
Techniques – Encapsulation
Confine information so it is only visible / accessible through an associated external interface
For some entity X in program Abstract data in X Abstract actions on data in X Collect data & actions on X in same location Protects and hides X
Abstraction & Encapsulation Example
Data List of student names Actions Create roster Add student Remove student Print roster
Only these actions can access names in roster
List of names create( ) addStudent( ) removeStudent( ) print( )
Java Interface
An Interface defines a contract Collection of Constants Abstract methods; no implementations Can not be instantiated Classes can implement interfaces Must implement all methods in interface Example class Foo implements Bar { … } Similar to abstract class But class can “inherit” from multiple interfaces
Java Collections Framework
Collection Object that groups multiple elements into one unit Also called container Example: ArrayList Collection framework consists of Interfaces Abstract data type Implementations Reusable data structures Algorithms Reusable functionality Collection – Java Interface See Java API entry for Collection Example (CollectionExample.java)