Chained Mutators
A Programming Pattern |
Prof. David Bernstein
|
Computer Science Department |
bernstdh@jmu.edu |
String
concatenationFile
object that
encapsulates the current working directory and you want to
know how many characters are in its namegetCanonicalPath()
returns
(and evaluates to) a String
object that has a
length()
methodappend()
method is a mutator?
Robot
Class with Mutators that Change its Location
Robot
ObjectString
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?