Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Paul Clapham
Ron McLeod
Jeanne Boyarsky
Tim Cooke
Sheriffs:
Liutauras Vilda
paul wheaton
Henry Wong
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Carey Brown
Frits Walraven
Bartenders:
Piet Souris
Himai Minh
Forum:
Programmer Certification (OCPJP)
Array with enhanced for loop for clarification
Kota li
Greenhorn
Posts: 20
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
What is the output of this code :
1: int []arr = {1,2,3,4};
2: for ( int i : arr )
3: {
4: arr[i] = 0;
5: }
6: for ( int i : arr )
7: {
8: System.out.println(i);
9: }
This is the output . Why is 0 0 3 0 changed like that pls any a clear that one .
Prints 0 0 3 0
ahmed yehia
Ranch Hand
Posts: 424
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
See this
Topic
for a similar question.
Popeye has his spinach. I have this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Arrays
enhanced for loop problem -- from a mock
Why will I get this output?
for each loop and array
Enhanced for-loop problem
More...