as interface inheritance.
Some real-world entities can change their forms. For example, water is naturally a
liquid, but it changes to a solid when frozen, and it changes to a gas when heated to
The ability to change form is known as polymorphism, and is useful to model in a
more concisely by introducing a single Shape class and its draw() method, and
by invoking that method for each Circle instance, Rectangle instance, and other
Shape instance stored in an array. When Shape 's draw() method is called for an
arrayinstance,itisthe Circle 's, Rectangle 'sorother Shape instance's draw()
methodthatgetscalled.Wesaythattherearemanyformsof Shape 's draw() method,
or that this method is polymorphic.
Every class X exposes an interface (a protocol consisting of constructors, methods,
increatingandcommunicatingwith X 'sobjects).Javaformalizestheinterfaceconcept
byprovidingreservedword interface ,whichisusedtointroduceatypewithoutim-
real reason for its existence. Instead, Java's interfaces feature was created to give de-
velopers the utmost flexibility in designing their applications, by decoupling interface
Objects are created via reserved word new , but how are they destroyed? Without
the application will not be able to continue. Java does not provide the developer with
the ability to remove them from memory. Instead, Java handles this task by providing
object from the heap, making more heap space available.
Nowthat youunderstand Java'ssupportforclasses andobjects, you'rereadytoex-