Java Reference
In-Depth Information
In
main( )
,
ob
is declared to be a reference to a
Series
interface. This means that it can be
used to store references to any object that implements
Series
. In this case, it is used to refer
to
twoOb
and
threeOb
, which are objects of type
ByTwos
and
ByThrees
, respectively,
which both implement
Series
. An interface reference variable has knowledge only of the
methods declared by its
interface
declaration. Thus,
ob
could not be used to access any
other variables or methods that might be supported by the object.