Format names to title case So I'm writing a program to format names to title case and display them in alphabetic order.  Any advice please?  And how can i add more methods?

public static void main (String [] args)
{    
    //local variables
    string name1;
    string name2;

     myLib = new Library();

     /********************   Start main method  *****************/

     //prompt user for first Name
     System.out.print("Enter First Name : ");
     name1 = Keyboard.readChar(); 

     //prompt user for second
     System.out.print("Enter Second Name : ");
     name2 = Keyboard.readChar(); 

     //Format names to Title Case
     name1.replace(0, name1.length(), name1.toString().toLowerCase());
     name2.replace(0, name2.length(), name2.toString().toLowerCase()); 

     name1.setCharAt(0, Character.toTitleCase(name1.charAt(0)));
     name2.setCharAt(0, Character.toTitleCase(name2.charAt(0)));

     //clear the screen
     myLib.clrscr();

     //Display names in alphabet order
     if (name1.toString().compareTo(name2.toString()) &gt;= 0) {
         System.out.println(name2 + " " + name1);    
     } else {
         System.out.println(name1 + " " + name2);
     }    

     //pause the screen
     //myLib.pause();

  } //end main method

} //end
Create a List

List&lt;String&gt; al = new ArrayList&lt;String();


and add (you can also use something like while(! stringRead.isEmpty()) {..} )

name = Keyboard.readChar()).toLowerCase();
al.add(name.substring(0, 1).toUpperCase() + name.substring(1));


EDIT after comment

1°) then Sort (the list is 'cloned') and print directly frome the Constructor return This solution is recommended to protect data published in a Web page.

System.out.println(new TreeSet&lt;String&gt;(al).toString());


2°) The List is sorted then printed

Collections.sort(al);
System.out.println(al.toString());