File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Iterator of an ArrayList

 
Joey Sanchez
Ranch Hand
Posts: 88
Eclipse IDE Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where does the error come from?

 
Henry Wong
author
Marshal
Pie
Posts: 20836
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joey Sanchez wrote:Where does the error come from?




You are trying to instantiate an object of the myL.interator class. Notice the "new" operator.... and it is complaining that it can't find such a class.

Henry
 
Zeeshan Sheikh
Ranch Hand
Posts: 144
Java MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iterator i = new myL.iterator(); //Wrong Statement

Just take new operator out

Iterator i = myL.iterator(); //Right Statement

You are accessing iterator method of ArrayList so there is no need for 'new' operator. Hope this helps.

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic