title: How to make a functioning to do list in java
body: <p>I am trying to make a functioning to do list with a limit of 10 elements, however I am having an issue with two major things in the to do list.</p>
  
  <p>The first is that after I first compile and run the program and select to add elements to the list, that functions properly, but if I add two elements and the 'stop' sentinel, when I select the next option to print the to do list, I am presented with a list, showing my two elements and then the stop sentinel along with 7 null values in the list. So the first issue I am having is to get rid of the null values, I attempted using a counter as you can see in my code however that was not proving to be effective.</p>
  
  <p>The next issue that I am having is that I am trying to make it so that you can add to the list, so once you select to add more things to the list, the new options the user writes, rewrites over them in the array and prints out the new values and not along with the old ones. I am assuming that can be done through some sort of recursion method but I am having a hard time figuring it out.</p>
  
  <p>Any help would be greatly appreciated!</p>
  
  <p>Thanks!</p>
  
  <pre><code>import java.util.Scanner;
  
  public class ToDo {
  public static void main(String[] args) {
  
      Scanner input = new Scanner(System.in);
  
      final int MAX = 10;
  
      String[] list = new String[MAX];
      int choice = 0;
  
      while (choice != 3) {
  
          System.out.println();
          System.out.println("Type 1 to add a new thing to your to do list.");
          System.out.println("Type 2 to print the to do list.");
          System.out.println("Type 3 to exit the program.");
          System.out.print("Select an option: ");
          choice = input.nextInt();
          int count = 0;
  
          if (choice == 1) {
              System.out.println("Keep hitting enter after to do's, if you want to stop, type 'stop'.");
              for (int i=0;i&lt;MAX;i++) {
                  list[i] = input.nextLine();
                  if (list[i].equals("stop")) break;
                  count++;
              }
          }
  
          if (choice == 2) {
              for (int index = 0;index &lt; list.length; index++) {
                  System.out.println(list[index]);                    
              }               
          }
  
      }
  
  }
  }
  </code></pre>