title: Java: How can I tell if one of my array String values is null?
body: <p>After many failed attempts to alphabetically sort an array, I have realized my failure is most likely due to one of my String array values being null. I tried both Arrays.sort() &amp; compareTo(), much like this user:
     <a href="https://stackoverflow.com/questions/18689672/how-to-sort-a-string-array-alphabetically-without-using-compareto-or-arrays-sor">How to sort a String array alphabetically (without using compareTo or Arrays.sort)</a></p>
  
  <p>...with the same results, most likely pointing to one of my values being null. How can I tell if one of my values is/are null? Is there a test? How did it get to be null? And most importantly, is this even the correct question to be asking? Thanks.</p>
  
  <pre><code>     String[] titleChoice = new String[5];
       String title = "", titleString = "";
       String[] authorChoice = new String[5];
       String author = "", authorString = "";
       int[] pageChoice = new int[5];
       String page = "", pageInt = "";
       String currentTitle;
       String currentPage = "";
       String formatEntry;
  
       int x = 0;
       int numEntered;
  
       int highestTitle = titleChoice.length - 1;
       int highestAuthor = authorChoice.length - 1;
       int highestPage = pageChoice.length - 1;
  
       final int MAX_ARRAY_SIZE = 5;
  
       boolean notQuit = true;
  
             Arrays.fill(titleChoice, "zzzzzzzzzzz");
             Arrays.fill(authorChoice, "zzzzzzzzzzz");
             Arrays.fill(pageChoice, 99999999);
  
       Scanner input = new Scanner(System.in);
  
       do
          {
  
          System.out.print("Enter the title of a book, or zzz to quit:");
             titleChoice[x] = input.next();
  
          if(!titleChoice.equals("zzz"))
             {
             LibraryBook inputBook = new LibraryBook();
             inputBook.setBook(titleChoice[x]);
  
             LibraryBook inputAuthor = new LibraryBook();
             System.out.print("Please enter " + titleChoice[x] + "'s author's last name: ");
                authorChoice[x] = input.next();
             inputAuthor.setAuthor(authorChoice[x]);
  
             LibraryBook inputPages = new LibraryBook();
             System.out.println("Please enter " + titleChoice[x] + "'s page count: ");
                pageChoice[x] = input.nextInt();
             inputPages.setPages(pageChoice[x]);
  
             x = x + 1;
             }
             else
                System.out.println("You have elected to quit the program. Goodbye.");
          }
       while(((!titleChoice.equals("zzz")) &amp;&amp; x &lt; 5) &amp;&amp; ((!authorChoice.equals("zzz")) &amp;&amp; x &lt; 5)     
           &amp;&amp; ((!pageChoice.equals("zzz")) &amp;&amp; x &lt; 5));
  
      //I just put this in here to see if it would compile
      Arrays.sort(titleChoice[x]); }}
  </code></pre>