F.14 Wrap-Up
In this appendix, we presented additional class concepts. The Time
class case study presented a complete class declaration consisting of private
data, overloaded public
constructors for initialization flexibility, set and get methods for manipulating the class’s data, and methods that returned String
representations of a Time
object in two different formats. You also learned that every class can declare a toString
method that returns a String
representation of an object of the class and that method toString
can be called implicitly whenever an object of a class appears in the code where a String
is expected.
You learned that the this
reference is used implicitly in a class’s non-static
methods to access the class’s instance variables ...
Get Android How to Program, 3/e now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.