Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package arraything;
- class ArrayThing {
- public static void main(String[] args) {
- // doing a little preliminary work
- int index=0;
- // declares an array of integers
- int[] anArray =
- {1,2,3,4,5,6,7,8,9,10};
- //set up the loop
- for (int item : anArray) {
- System.out.println("Index " + index++ + " is: " + item);
- }
- }
- }
Add Comment
Please, Sign In to add comment