title: return statement executes twice without loop
body: <pre><code>import java.util.Scanner;
  
  public class WordShuffle
  {
      static Scanner in = new Scanner(System.in);
  
      private static String getText()
      {
          log("in getText");
          String t;
          log("Enter only alphabets");
          t = in.next();
          log("returned t= " + t);
          return t;
      }
  
      private static void shuffleText(final String txt)
      {
          log("in shuffle= " + txt);
          final int textLenght = txt.length();
          final char textArray[] = new char[textLenght];
          for (int i = 0; i &lt; textLenght; i++)
          {
              textArray[i] = txt.charAt(i);
          }
          for (int i = 0; i &lt; textLenght; i++)
          {
          }
      }
  
      public static void log(final String l)
      {
          System.out.println(l);
      }
  
      private static String validateText()
      {
          final String text = getText();
          log("in validate= " + text + "");
          final char[] tc = text.toCharArray();
  
          for (final char t : tc)
          {
              if (Character.isLetter(t))
              {
                  log("character = " + t);
              }
              else
              {
                  System.out.println("Error occured, non alphabet found in text");
                  log("error = " + t);
                  validateText();
              }
          }
          log("validate returned " + text);
          return text;
      }
  
      /**
       * @param args the command line arguments
       */
      public static void main(final String[] args)
      {
          // TODO code application logic here
          shuffleText(validateText());
      }
  }
  </code></pre>
  
  <p>if this is run with sample texts "abc", it runs fine,
  with smaple text "abc3" it points out the error 3 and recurs the validate() method
  on requesting for input again, if sample text "abc" is entered it return the text "abc" and "abc3" one after the other.</p>
  
  <p>console output is below</p>
  
  <pre><code>run:
  in getText
  Enter only alphabets
  abc3
  returned t= abc3
  in validate= abc3
  character = a
  character = b
  character = c
  Error occured, non alphabet found in text
  error = 3
  in getText
  Enter only alphabets
  abc
  returned t= abc
  in validate= abc
  character = a
  character = b
  character = c
  validate returned abc
  validate returned abc3
  in shuffle= abc3
  BUILD SUCCESSFUL (total time: 8 seconds)
  </code></pre>