java - "For each" loop for two object -
arraylist<string> date=new arraylist<string>(); arraylist<string> time=new arraylist<string>(); //addition of elements in list ... ... for(string x :date,string y: time) { system.out.println(x+" "+y); }
is 2 objects can iterate single "for each" loop? tried above code,i got compilation error. syntax mistake there?
nope, isn't going work. there no way for-each loop; have normal loop either explicit indices or iterators.
Comments
Post a Comment