title: how to change name to last name comma first name java
body: <p>I have a question on how to convert a name to last name comma first name. In my case, I am doing this from a static method. I think I did the coding right but when I run it, I get nothing. How can I fix this? Any help will be greatly appreciated. Below is my code:</p>
  
  <p>Testing1.java:</p>
  
  <pre><code>import java.io.*;
  
  public class Testing1 {
  
      public static String convertName(String name) {
          String firstName = name.substring(0, name.indexOf(" "));
          String lastName = name.substring(name.indexOf(" "));
          String cName =  lastName + firstName;
          return cName;
      }
  
      public static void main(String args[]) {
          String name = "Grace Hopper";
          convertName(name);
      }
  }
  </code></pre>