title: Why does Android Studio insist that I make this void?
body: <p>I have a simple class here that consists of an array of words and what I was hoping to be the start of a method that grabs random words from that array. I do not understand Java as much, so I cannot understand why Android Studio wants me to return null on this.</p>
  <pre><code>import java.util.Random;
  
  public class RandomSentence {
      public String[] mWords = {
          &quot;string1&quot;, &quot;string2&quot;, &quot;string3&quot;, &quot;string4&quot;};
  
      public String getSentenceResult() {
          for (int i = 0; i &lt; 10; ++i) {
              return this.mWords[new Random().nextInt(this.mWords.length)];
          }
      } // error appears here 
  }
  </code></pre>