Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Iterator loop ...  RSS feed

 
Jack Weavesham
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I've tried to write an iteration loop as below:

public void listStudentDetails()
{
Iterator it = students.iterator();
while(it.hasNext()) {
Student students = (Student) it.next();
System.out.println("Name: " + students.getStudentName());
System.out.println("ID: " + students.getIDNumber());
System.out.println("Study Programme: " + students.getStudyProgramme());
System.out.println("Paid fee: " + students.getPaid());
Can anyone say why this doesn't work?
Thanks in advance.
JW
 
Jon Strayer
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the symptoms?
 
Jack Weavesham
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For whatever reason, it compiles okay, but you can't call the method - ideas?
Thanks.
JW
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jack Weavesham:
For whatever reason, it compiles okay, but you can't call the method - ideas?

What exactly happens when you try to call it?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And how are you trying to call it from where?
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jack Weavesham:
For whatever reason, it compiles okay, but you can't call the method - ideas?
Thanks.
JW

I'm sure *I* could call the method, if I new which class it was in ;-)
Seriously though, which method can't you call? What happens when you try? Any details you can give us will help us help you.
Good luck
Layne
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!