Download presentation
Presentation is loading. Please wait.
Published byGertrude Cecily Lee Modified over 9 years ago
1
CS 2511 Fall 2014
2
Features of Object Oriented Technology Abstraction Abstract class Interfaces Encapsulation Access Specifiers Data Hiding Inheritance Polymorphism
3
Encapsulation A software development technique that consists of isolating a system function or a set of data and operations on those data within a module and providing precise specifications for the module -IEEE Principle of binding processes (Member Method) and data (Member Data) to form an integrated unit is the essence of Encapsulation Implemented by using the concept of Class
4
Access/Visibility Specifiers Used for accessibility of data member and member methods from within and outside the class boundary Examples: Private Public Protected Default / Package
5
Data Hiding Process of hiding the members from outside the class Implemented by the concept of “Private” access specifiers Can be accessed only by the member methods of that class where it is defined Data hiding is an important feature of OO programming which allows the data member to be kept safe
6
Accessors and Mutators Constructor methods: A new instance of an object is created by calling a constructor method. Values can be passed to a constructor method to set the initial state of an object. Accessor methods: For every private field we can create a public method that will return its value. Mutator methods: For every private field we can create a public method that will set its value. If you want a private field to be read only do not create a mutator method for it.
7
DATE CLASS Present in the java.util package. Some of the methods: boolean after (Date when) boolean before (Date when) int compareTo(Date anotherdate) long getTime() Void setTime() Date d = new Date (y, m, d);
8
INTERFACE IN UML DIAGRAMS
9
COMPARABLE INTERFACE Collections.sort(list) int compareTo (Class obj) COMPARATOR INTERFACE Changing the sort order int compare (T obj1, T obj2)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.