|
Chained Mutators
A Programming Pattern |
|
Prof. David Bernstein
|
| Computer Science Department |
| bernstdh@jmu.edu |
String concatenation
File object that
encapsulates the current working directory and you want to
know how many characters are in its name
getCanonicalPath() returns
(and evaluates to) a String object that has a
length() method
append() method is a mutator?
Robot Class with Mutators that Change its Location
Robot Object
String methods
(like toLowerCase()) return
a String object. Why? Are String
objects mutable?StringBuilder methods (like
append()) return a StringBuilder
object. Why? Are StringBuilder objects mutable?