title: How to separate each word from a string in java?
body: <p>One of my AP projects includes separating each word from a string, I have tried accomplishing numerous times yet with no success! My class has not yet learned about arrays, regex, or split yet so if you could help please avoid any of those. However we did learn substring, charAt, indexOf, length, trim ...</p>
  
  <p>This is one of my attempts:
  (notice that in order for me to actually notice I've split them I try adding <code>N</code> to the string I am re-creating, which is newWord) </p>
  
  <pre><code>public class Functions {
  public static String stringReversal(String word){
      if (word.length() &lt;= 1){
          return word;
      }else{
          char c = word.charAt(0);
          return stringReversal(word.substring(1)) + c;
      }
  }
  
  public static Boolean palindrome(String word){
      Boolean palindrome;
      if (word.equalsIgnoreCase(stringReversal(word))){
          return palindrome = true;
      } else{
          return palindrome = false;
      }
  }
  
  public static String pigLatin(String sentence){
      if(sentence.length() &lt;= 1){
          return sentence;
      } else {
         String newWord = "";
         return newWord += pigLatin(sentence.substring(0, sentence.indexOf(" "))) + " N ";
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Main: </p>
  
  <pre><code>public class Main {
  public static void main (String [] args){
      Scanner in = new Scanner(System.in);
      String word = in.nextLine();
      System.out.println(Functions.test(word));
     }
  } 
  </code></pre>
  
  <p>However the output only print <code>N</code>! Can anyone please help and show a way that I can accomplish this, I've tried many ideas yet none worked.</p>