... accessible outside the class. Lines 7–9 attempt to access the private
instance variables hour
, minute
and second
of the Time1
object time
. When this program is compiled, the compiler generates error messages that these private
members are not accessible. This program assumes that the Time1
class from Fig. 8.1 is used.
Get Java How to Program, Early Objects, 11th Edition 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.