Lecture7-Feb6-Interfaces2

Lecture7-Feb6-Interfaces2 - 1 1 / 162 COP 3503 SPRING 2012...

Info iconThis preview shows pages 1–19. Sign up to view the full content.

View Full Document Right Arrow Icon
1 / 162 COP 3503 SPRING 2012 Shayan Javed Lecture 7 Programming 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 / 162 More With Interfaces
Background image of page 2
3 / 162 Interfaces Language construct for specifying functionality without implementation Method specifications but no implementations.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 / 162 Interfaces in Software Engineering In large projects you have a lot of classes interacting with each other
Background image of page 4
5 / 162 Interfaces in Software Engineering In large projects you have a lot of classes interacting with each other Need formal descriptions of what a class does, and how it interacts with other classes.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 / 162 Interfaces in Software Engineering In large projects you have a lot of classes interacting with each other Need formal descriptions of what a class does, and how it interacts with other classes. Interfaces are a way to define expected behavior.
Background image of page 6
7 / 162 Interfaces in Software Engineering In large projects you have a lot of classes interacting with each other Need formal descriptions of what a class does, and how it interacts with other classes. Interfaces are a way to define expected behavior.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 / 162 Interfaces Some interfaces already defined in Java Widely used Comparable Comparator Cloneable
Background image of page 8
9 / 162 The Comparable interface Defined in the java.lang Package
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 / 162 The Comparable interface Defined in the java.lang Package public interface Comparable { public int compareTo(Object o); }
Background image of page 10
11 / 162 The Comparable interface public interface Comparable { public int compareTo(Object o); }
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
12 / 162 The Comparable interface public interface Comparable { public int compareTo(Object o); } Comparisons between objects of the same type
Background image of page 12
13 / 162 The Comparable interface public interface Comparable { public int compareTo(Object o); } Comparisons between objects of the same type Object1. compareTo (Object2)
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
14 / 162 The Comparable interface public interface Comparable { public int compareTo(Object o); } Comparisons between objects of the same type Object1. compareTo (Object2) Return values: < 0 = Object 1 < Object 2 (usually -1 )
Background image of page 14
15 / 162 The Comparable interface public interface Comparable { public int compareTo(Object o); } Comparisons between objects of the same type Object1. compareTo (Object2) Return values: < 0 = Object 1 < Object 2 (usually -1 ) == 0 = Object 1 == Object 2
Background image of page 15

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
16 / 162 The Comparable interface public interface Comparable { public int compareTo(Object o); } Comparisons between objects of the same type Object1. compareTo (Object2) Return values: < 0 = Object 1 < Object 2 (usually -1 ) == 0 = Object 1 == Object 2 > 0 = Object 1 > Object 2 (usually 1 )
Background image of page 16
17 / 162 The Comparable interface Used commonly.
Background image of page 17

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The Comparable interface Used commonly. For ex. the
Background image of page 18
Image of page 19
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/15/2012 for the course COP 3503 taught by Professor Staff during the Spring '12 term at University of Florida.

Page1 / 162

Lecture7-Feb6-Interfaces2 - 1 1 / 162 COP 3503 SPRING 2012...

This preview shows document pages 1 - 19. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online