| Author |
Objects and Collections
|
sri rallapalli
Ranch Hand
Joined: Mar 15, 2005
Posts: 88
|
|
in K&B book, page no:18, of Objects and Collections chapter, figure says that LinkedHashMap is not an instance of HashMap. But in the following example, it is showing that LinkedHashMap is an instance of HashMap. import java.util.*; class GFC111 { public static void main (String[] args) { Object m = new LinkedHashMap(); System.out.print((m instanceof Collection)+","); System.out.print((m instanceof Map)+","); System.out.print(m instanceof HashMap); }} Please Calrify my Doubt. I want to know whether the figure in K&B book is wrong or correct. thanks, Sri.
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16695
|
|
According to the Javadoc, the LinkedHashMap class does indeed inherit from the HashMap class. Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Bert Bates
author
Sheriff
Joined: Oct 14, 2002
Posts: 8712
|
|
Dang! How did I miss that one Just finishing up the errata list - so far 5 confirmed errata, and about 5 good suggestions...
|
Eliminate fossil fuel subsidies. (If you're not on the edge, you're taking up too much room.)
|
 |
ak pillai
author
Ranch Hand
Joined: Feb 11, 2006
Posts: 288
|
|
|
public class LinkedHashMap extends HashMap implements Map
|
java j2ee job interview questions with answers | Learn the core concepts and the key areas
|
 |
 |
|
|
subject: Objects and Collections
|
|
|