title: Can't figure out why I am getting null values
body: <p>The program is supposed to print out the amount of times each name has been selected (this is indicated by number of asterisks (*). I have most of the code working but for some reason the output contains two null values for each name and I am not sure how to fix the problem. Also if you have the time, I'm also struggling to find out which name has the most amount of asterisks. Here's an example output:</p>
  
  <p>1: nullnull************************ Conner</p>
  
  <p>2: nullnull********************************** John
  etc...
  (it does this for all 10 names)</p>
  
  <pre><code>public class RandomStudentsLab {
      public static void main(String[] args){
  
          //create an array with 10 students
          String [] StudentList = new String[10];
          String [] StarString = new String[10];
          String [] FinalString = new String[10];
  
          //add 10 names to the student list
          StudentList[0] = "Conner";
          StudentList[1] = "John";
          StudentList[2] = "Alex";
          StudentList[3] = "Robert";
          StudentList[4] = "James";
          StudentList[5] = "Carl";
          StudentList[6] = "Sarah";
          StudentList[7] = "Bob";
          StudentList[8] = "Ethan";
          StudentList[9] = "Chris";
  
  
          //loop 250 times selecting each student randomly
  
          for(int i=0; i&lt;250; i++){
              int randomNum = (int)((Math.random()*10));
              for(int x=0; x&lt;10; x++){
                  if(randomNum == x){
                      StarString[x] += "*";
                  }
              }
          }
  
  
  
          for(int z=0; z&lt;10; z++){
              System.out.println((z+1)+": "+(FinalString[z] += StarString[z] + " "+StudentList[z]));      
          }
  
      }
  
  }
  </code></pre>