Skip Top Navigation Bar
Why Java?
Learner's Corner
Teacher's Corner
Java Playground
Home
Getting Setup
Learn
Practice
Apply
Other Resources
Evaluate Code Segments that Iterate Over an ArrayList
Evaluating Expressions
Grab a Piece of Paper!
Evaluate each expression.
Verify your answer by running the code in the Java Playground.
Iterate Over ArrayList Tutorial
Practice 1: Animal List
Trace the provide code segment and predict the output.
Verify your prediction is correct by running the code in the Java Playground.
Modify the code segment to print the name of each animal. Run the code to test.
Modify the code to change the names of the animals to be all uppercase. Run the code to test.
Practice 2: XYZ Practice
Trace the provide code segment and predict the output.
Verify your prediction is correct by running the code in the Java Playground.
Practice 3: Sum the Values
Trace the provide code segment and predict the output.
Verify your prediction is correct by running the code in the Java Playground.
Modify the code to print a running total as each value is added to sum. It should print 2.5 and then 6.5 and then 12. Run your code to test.
Practice 4: Reverse Order
Trace the provide code segment and predict the output.
Verify your prediction is correct by running the code in the Java Playground.
Practice 5: Update Numbers
Trace the provide code segment and predict the output.
Verify your prediction is correct by running the code in the Java Playground.
Practice 6: Even or Odd
Trace the provide code segment and predict the output.
Verify your prediction is correct by running the code in the Java Playground.
Modify the code so that only odd values are printed. Verify your code is correct by running it.