Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Danielle Daniels   on Nov 20 In Java Category.

  
Question Answered By: Abbad Akhtar   on Nov 20


> 1. Here is line  27 in WordList.java.
iterator  i = myWords.keySet().iterator();
>
>
>
> a. Write the declaration  header for the iterator method.
>
> The question  seems ambiguous to me. I know that class  Iterator has
> three methods  hasNext(), next(), and remove() but concerning the Map
> myWords.keySet() what exactly does iterator() stand  for here. Of

That I cannot tell as you have not told me what class myWords is.

> course, the next  line in the program  is something like
>
> while (iterator.hasNext())

surely you mean while ( i.hasNext() )

> but does myWords.keySet().iterator() mean iterator here is i.hasNext
> ()?

Share: