Tuesday, 10 February 2009

Java™ How to Program, Sixth Edition - Part10

Few weeks back i started reading Java™ How to Program, Sixth Edition By H. M. Deitel - Deitel & Associates, Inc., P. J. Deitel - Deitel & Associates, Inc.

Nice book written By H. M. Deitel - Deitel & Associates, Inc., P. J. Deitel - Deitel & Associates, Inc.

I wanted to share few quotations found the book from the 10th chapter.

1) With polymorphism, it is possible to design and implement systems that are more easily extensible. Programs can be written to process even objects of types that do not exist when the program is under development.

2) There are many situations in which it is useful to declare abstract classes for which the programmer never intends to create objects. These are used only as superclasses, so we sometimes refer to them as abstract superclasses. You cannot instantiate objects of an abstract class.

3) Classes from which objects can be created are called concrete classes.

4) A class must be declared abstract if one or more of its methods are abstract. An abstract method is one with keyword abstract to the left of the return type in its declaration.

5) If a class extends a class with an abstract method and does not provide a concrete implementation of that method, then that method remains abstract in the subclass. Consequently, the subclass is also an abstract class and must be declared abstract.

6) Java enables polymorphismthe ability for objects of different classes related by inheritance or interface implementation to respond differently to the same method call.

7) When a request is made through a superclass reference to a subclass object to use an abstract method, Java executes the implemented version of the method found in the subclass.

8) Although we cannot instantiate objects of abstract classes, we can declare variables of abstract class types. Such variables can be used to reference subclass objects.

9) Due to dynamic binding (also called late binding), the specific type of a subclass object need not be known at compile time for a method call off a superclass variable to be compiled. At execution time, the correct subclass version of the method is called, based on the type of the reference stored in the superclass variable.

10) Operator instanceof checks the type of the object to which its left operand refers and determines whether this type has an is-a relationship with the type specified as its right operand. If the two have an is-a relationship, the instanceof expression is true. If not, the instanceof expression is false.

11) Every object in Java knows its own class and can access this information through method getClass, which all classes inherit from class Object. Method getClass returns an object of type Class (package java.lang), which contains information about the object's type that can be accessed using Class's public methods. Class method getName, for example, returns the name of the class.

12) An interface declaration begins with the keyword interface and contains a set of public abstract methods. Interfaces may also contain public static final fields.

13) To use an interface, a class must specify that it implements the interface and must either declare every method in the interface with the signatures specified in the interface declaration or be declared abstract.

14) An interface is typically used when disparate (i.e., unrelated) classes need to provide common functionality (i.e., methods) or use common constants.

15) An interface is often used in place of an abstract class when there is no default implementation to inherit.

16) When a class implements an interface, it establishes an is-a relationship with the interface type, as do all its subclasses.

17) To implement more than one interface, simply provide a comma-separated list of interface names after keyword implements in the class declaration.

About the Authors

Dr. Harvey M. Deitel, Chairman and Chief Strategy Officer of Deitel & Associates, Inc., has 43 years experience in the computing field, including extensive industry and academic experience. Dr. Deitel earned B.S. and M.S. degrees from the Massachusetts Institute of Technology and a Ph.D. from Boston University. He worked on the pioneering virtual-memory operating-systems projects at IBM and MIT that developed techniques now widely implemented in systems such as UNIX, Linux and Windows XP. He has 20 years of college teaching experience, including earning tenure and serving as the Chairman of the Computer Science Department at Boston College before founding Deitel & Associates, Inc., with his son, Paul J. Deitel. He and Paul are the co-authors of several dozen books and multimedia packages and they are writing many more. With translations published in Japanese, German, Russian, Spanish, Traditional Chinese, Simplified Chinese, Korean, French, Polish, Italian, Portuguese, Greek, Urdu and Turkish, the Deitels' texts have earned international recognition. Dr. Deitel has delivered hundreds of professional seminars to major corporations, academic institutions, government organizations and the military.

Paul J. Deitel, CEO and Chief Technical Officer of Deitel & Associates, Inc., is a graduate of the MIT's Sloan School of Management, where he studied Information Technology. Through Deitel & Associates, Inc., he has delivered Java, C, C++, Internet and World Wide Web courses to industry clients, including IBM, Sun Microsystems, Dell, Lucent Technologies, Fidelity, NASA at the Kennedy Space Center, the National Severe Storm Laboratory, Compaq, White Sands Missile Range, Rogue Wave Software, Boeing, Stratus, Cambridge Technology Partners, Open Environment Corporation, One Wave, Hyperion Software, Adra Systems, Entergy, CableData Systems and many other organizations. Paul is one of the most experienced Java corporate trainers having taught about 100 professional Java training courses. He has also lectured on C++ and Java for the Boston Chapter of the Association for Computing Machinery. He and his father, Dr. Harvey M. Deitel, are the world's best-selling Computer Science textbook authors.

No comments: