title: Return as String Value from For Loop Java
body: <p>I'm trying to create a loop of 50 characters and then return the whole 50 characters as a String, but unfortunately the String is only returning the last letter, and not all 50 characters. getRandomUpperChar() is just a method I created to get a random Uppercase char value from 'A' to 'Z'.</p>
  
  <pre><code>public static String initializeKey(int num , int minNum, int maxNum) {
      String random = "";
      for(int j = 0; j &lt;num; j++) {
          getRandomUpperChar();
          char Xp = getRandomUpperChar(minNum, maxNum);
  
          random = "" +  Xp;
          System.out.print(random);
      }
      return random;
  }
  </code></pre>