title: Capitalize First Letter of Last Name
body: <p>I want the last name to print with there first letter only capitalized but I get all of the last name capitalized. I want the user to input their name like Jordan Torres and give back Torres, J.</p>
  
  <pre><code>import java.util.*; // for Scanner
  
  public class ProcessName { public static void main(String[] args) { String name;
    Scanner console = new Scanner(System.in); 
      System.out.print("Type your name: "); //send to user
  
    name = console.nextLine();
       String[] nameArray = name.split(" ");//split string into array
  
       String firstName = name.valueOf(name.charAt(0)).toUpperCase(); //get first letter 
       String lastName = name.substring(name.indexOf(" ") + 1).toUpperCase();
  
       String myName = lastName + ", " + firstName;//give last and first name
  
         System.out.println("Your name is: " + myName + ".");   
  </code></pre>
  
  <p>My output is TORRES, J.</p>