aspose file tools
The moose likes Beginning Java and the fly likes A Collection of javabeans Iterator Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "A Collection of javabeans Iterator " Watch "A Collection of javabeans Iterator " New topic
Author

A Collection of javabeans Iterator

Higgledy Smith
Ranch Hand

Joined: Mar 07, 2006
Posts: 192
I in my code I create a collection of Department javabeans. Department class contains an overridden toString() method.

In the Iterator code below, how do I guarantee the toString() used is the overridden Department toString and not the Java provided Object toString?

Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24057
    
  13

It is impossible for it to be anything else. If a class overrides a method, then no other class can call the original version on objects of that class; they can only call the new, overriding version.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: A Collection of javabeans Iterator
 
Similar Threads
How to clone a object containing collection?
how to print objects from linked list?
Vector reference?
Question? int[] Vs Integer[]
SCJP doubt page 549