Question: I've got a program that checks whether a list is sorted or not. How do I print the answer? (i.e "The list is sorted", "The list is not sorted").

```
public class CheckList {

public static void main(String[] args) {
    int[] myList = new int[10];

    // Read in ten numbers
    Scanner input = new Scanner(System.in);
    System.out.println("Enter ten numbers: ");
    for (int i = 0; i < myList.length; i++) {
        myList[i] = input.nextInt();

    }
}

//Check if list is sorted
public static boolean isSorted(int[] myList) {
    if (myList[0] > 1) {
        for (int i = 1; i < myList[0]; i++)
            if (myList[i] > myList[i + 1])
                return false;
    }
    return true;
}
}

```

Answer: 
Just call the method inside a `if`:

```
if(isSorted(myList)) {
    System.out.println("Array is sorted");
} else {
    System.out.println("Array is not sorted");
}

```

Anyway, your `isSorted` method won't work, i would make something like this:

```
//checks if array is sorted in ascending order
public static boolean isSorted(int[] myList) {
    if(myList == null) return false; //just checking

    for (int i = 0; i < myList.length - 1; i++) {
        if (myList[i] > myList[i + 1]) {
            return false;
        }
    }
    return true;
}

```
*Just call the method after your `for loop`*

```
for (int i = 0; i < myList.length; i++) {
      myList[i] = input.nextInt();
    }
if(isSorted(myList)) {
    System.out.println("The list is sorted");
} else {
    System.out.println("The list is not sorted");
}

```