title: Java program on name Initials
body: <p>I am writing a program that will give the Initials of the name(String) user gives as input.
  I want to use the <code>Space function</code> while writing the name as the basis of the algorithm.
  For eg: </p>
  
  <pre><code>&lt;Firstname&gt;&lt;space&gt;&lt;Lastname&gt;
  </code></pre>
  
  <p>taking the char once in a for loop and checking if there is a space in between, if there is it will print the charecter that was just before.
  Can someone tell me how to implement this?
  I'm trying this but getting one error.</p>
  
  <p>Any help is dearly appreaciated..
  P.S- i am new to java and finding it a lot intresting. Sorry if there is a big blunder in the coding</p>
  
  <pre><code>public class Initials {
      public static void main(String[] args) {
          String name = new String();
          System.out.println("Enter your name: ");
          Scanner input = new Scanner(System.in);
          name = input.nextLine();
  
          System.out.println("You entered : " + name);
          String temp = new String(name.toUpperCase());
  
          System.out.println(temp);
  
          char c = name.charAt(0);
          System.out.println(c);
  
          for (int i = 1; i &lt; name.length(); i++) {
              char c = name.charAt(i);
  
              if (c == '') {
                  System.out.println(name.charAt(i - 1));
              }
  
          }
      }
  }
  </code></pre>
  
  <p><strong>EDIT</strong>:
  Ok Finally got it. The algorithm is a lot fuzzy but its working and will try to do it next time with Substring..</p>
  
  <pre><code>for (int i = 1; i &lt; temp.length(); i++) {
      char c1 = temp.charAt(i);
  
      if (c1 == ' ') {
          System.out.print(temp.charAt(i + 1));
          System.out.print(".");
      }
  }
  </code></pre>
  
  <p>Thanks a lot guys :)</p>