CS 211: Video Presentations
1 Notes
Ignore any due dates mentioned in the videos as they are relevant only to previous years.
The videos give a brief overview of inheritance. The PrintWriter
class discussed in the 2nd video and an example of how to extend is
the subject of the final video. These two are particularly relevant to
Spring 2017 Lab 5 Exercises.
2 Video Presentations
- Inheritance Basics
- How to set up a couple related classes
- Child inherits fields and methods from parent
- PrintWriter Intro
- An output class
- Can write to the screen
- Can write to files
- As
Scanner
is to input,PrintWriter
is to output
- ScreamWriter extends PrintWriter
- Inherit behavior like
println
fromPrintWriter
- But modify it subtly
- Instead of printing, SCREAM THE TEXT
- Utilize a method from
String
to upper case - Direct applications Lab05 Exercises
- Inherit behavior like
- Defining
equals(Object)
Methods- All classes have an
equals(Object)
method - Inherited version usually doesn't behave as expected
- Overriding it for proper deep equality is customary
- Requires
instanceof
checks and casting
- All classes have an
- Dynamic Dispatch
- Many versions of a method can exist
- Invoking a method
x.doSomething()
calls the most special version ofdoSomething()
- Version run depends on the runtime class of
x
- Calling a method on an argument
doIt(x)
does not call a special version - Whatever compile time type
x
is will be the version of the method called
- Project 5 Testing Problem Intro
- Setup for Project 5 Testing problem
- DrJava Testing, setting class path
- Dealing with testing multiple implementations on command line and batch scripts
- Project 5 DrJava Debugger
- Basic debugger setup
- Stepping in/over/resume
- Debugging with program command line arguments