# Teaching

### Site Tools

dma:java13:assignment10

# Assignment 10

## Part 1 - Group Exercise

See if you can predict what these lines of code do. Only type it in if you need to or you want to check.

```for (int i = 0; i < 7; i++)
System.out.println(i);

for (int i = 0; i <= 7; i++)
System.out.println(i);

for (int i = 7; i == 0; i--)
System.out.println(i);

for (int i = 7; i < 0; i--)
System.out.println(i);

for (int i = 7; i > 0; i--)
System.out.println(i);

for (int i = 0; i < 7; i--)
System.out.println(i);```

if you are done, you can work on Assignment 11

## Part 2 - Do it yourself!

Open up Eclipse, if you haven't already. Create a new PROJECT.

1. Create your new class and main function
1. PLEASE REFER TO THE HANDOUTS or PAST PROJECTS for REFERENCE
2. In your main function, declare an array
3. Using the curly braces you've seen, fill the array with a bunch of numbers
4. Now, print out the contents of the array using System.out.println

Take screenshots and save your code for reference.

```
public class ForLoops {

public static void main (String[] args) {

int[] array = {34,52,36,4,222,-1,0,33,-42,77};

for (int i=0; i<array.length; i++)
System.out.println("i = " + i + " array = " + array[i]);

}

}```

## Part 3 - Java Applications

When you get a chance, review these exercises with the SOLUTION code: SOLUTION CODE

Animations