0921 - Abstract classes, static components Midterm I...

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

View Full Document Right Arrow Icon
Abstract classes, static components
Background image of page 1

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

View Full DocumentRight Arrow Icon
Midterm I Wednesday, Sep 30 Covering. .. Homework Lecture notes Everything said in class Lab materials Old exams will be available soon ! 9/18/08 CIS 120 2
Background image of page 2
Tutoring Walk-in tutoring for CIS 110, 120, and 121 are available. .. in Moore 207 on Sunday and Monday nights 6pm-10pm throughout the Fall semester 9/18/08 CIS 120 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
A Small Correction 9/18/08 CIS 120 4 > s = "foo"; > t = "foo" > s == t false public class Test { public void test () { String s = "foo"; String t = "foo"; System.out.println(s == t); } } In the Interaction pane. .. In a file Test.java. .. Prints “ true ”! DrJava’s Interactions pane behaves a little bit differently from the Java compiler in a few cases. Here, the compiler is using a “string table” for constant strings.
Background image of page 4
The Example I Should Have Given 9/18/08 CIS 120 5 > s = new Integer(1) > t = new Integer(1) > s == t false public class Test { public void test () { String s = new Integer(1); String t = new Integer(1); System.out.println(s == t); } } In the Interaction pane. .. In a file Test.java. .. Prints “ false
Background image of page 5

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

View Full DocumentRight Arrow Icon
BACK TO INTERFACES. .. 9/18/08 CIS 120 6
Background image of page 6
9/18/08 CIS 120 Interfaces (recap) Capture what is common to a set of similar classes Provide a contract that every member of that set must fulfill public interface Displaceable { public double getX (); public double getY (); public void move(double dx , double dy ); } 7
Background image of page 7

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

View Full DocumentRight Arrow Icon
1/30/09 CIS 120 Interface benefits and problems A class may implement several interfaces: multiple viewpoints Enforce standard interfaces for common services like sorting No way of sharing common functionality among classes that implement the same interface 8
Background image of page 8
1/30/09 CIS 120 Abstract classes Classes with some abstract methods, which are declared but not implemented Some concrete methods, constructors, and instance variables can also be provided Abstract classes cannot be used to create objects Abstract classes can be extended into concrete
Background image of page 9

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

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 04/22/2010.

Page1 / 29

0921 - Abstract classes, static components Midterm I...

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

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