• Post Reply Bookmark Topic Watch Topic
  • New Topic

Enhanced Object For Loop  RSS feed

 
Joel Christophel
Ranch Hand
Posts: 250
1
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




What's wrong with this?
 
Ove Lindström
Ranch Hand
Posts: 326
Android Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are no objects to iterate over in the objArray.

Also, the array is not an array of integers, it is an array of DummyClass.

And you are trying to assign a new DummyClass to an variable declared as an integer.

Now I've run the compiler on your code.


Type mismatch: cannot convert from element type DummyClass to int Lesson_19_Questions.java line 10
DummyClass cannot be resolved to a variable Lesson_19_Questions.java line 11
The primitive type int of dumNum does not have a field jj Lesson_19_Questions.java line 12

All these errors are more or less self explanatory.







 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joel Christophel wrote:
What's wrong with this?

What is the error? Hint :
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I’ll give you another hint: there is an example of a for-each loop like that in the Java Tutorials. You can find more in the Java Language Specification, but that can be difficult to read.

You might also find it difficult to open; the server is giving me “Can’t find page” errors.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!