wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes for loop problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "for loop problem" Watch "for loop problem" New topic
Author

for loop problem

gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924
    
    1

please refer the kb6 book page no 349. the book says

The next example demonstrates a for loop with multiple variables in play. A
comma separates the variables, and they must be of the same type. Remember that
the variables declared in the for statement are all local to the for loop, and can't
be used outside the scope of the loop




why is this happening ?
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
I don't have the book for reference. May be the book refers to declaring more than one type in the for loop.

Helen Ma
Ranch Hand

Joined: Nov 01, 2011
Posts: 451
In a for loop , only one type of variable can be declared, according to the KB book.
 
Don't get me started about those stupid light bulbs.
 
subject: for loop problem
 
Similar Threads
Merge sort failure
overriding
In wrapper class..
type cast
Basic For Loop Issue