English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

a question in java..

2007-03-14 10:33:19 · 5 answers · asked by vinay m 1 in Computers & Internet Programming & Design

5 answers

So they can remember what it was like! Du..........!

2007-03-14 10:53:32 · answer #1 · answered by ? 4 · 0 1

The decision as to which version of the method to execute is based on the actual type of object whose reference is stored in the reference variable, not on the type of the reference variable on which the method is invoked. This runtime polymorphism is enabled by holding subclass objects in superclass references.

2007-03-14 17:41:09 · answer #2 · answered by Magic Z 1 · 0 0

Using a reference to a superclass or interface, known as "coding to the interface" allows code that uses the oject to not work with any class that implements the interface or extends the superclass; you can change the implentation (i.e. changing a List from ArrayList to LinkedList) by only modifying the code that creates it, and the rest of the code will work with the new implementation without needing to be modified.

2007-03-14 17:51:27 · answer #3 · answered by undercoloteal 3 · 0 1

Using super class reference to hold subclass objects help you achieve one of the objectives of Object oriented programming - "Dynamic/Runtime binding". This helps in delegating the overridden behaviour to the right subclass at runtime.

2007-03-14 17:37:56 · answer #4 · answered by AshNix 1 · 0 0

a subclass extends a superclass, it can also have additional attributes and methods not existing in the superclass.

2007-03-14 17:36:54 · answer #5 · answered by phoenix_61_98 3 · 0 1

fedest.com, questions and answers