Java split text by lines (other solutions didn't work)
<p>I am writing code to split lines in java but it doesn't work properly.</p>

<pre><code>import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.lang.*;

public class mainprogram {
    public static void main(String [] args ) throws FileNotFoundException, IOException
    {
    //creating object for purpose of writing into file
    writFile ObjectwritFile = new writFile();

    //creating object for purpose of reading from file
    loadFile ObjectloadFile = new loadFile();

    //this will be used for storing text into from file
    String text="";

    //text = ObjectloadFile.loadFile("C://names.txt");

    System.out.println(text);

    ObjectwritFile.writeFile("C://testfile.txt",text);

   //these regexp didn't work
    //String regexp = "[\\r\\n]+"; 
   //String regexp = "[\\s,;\\n\\t]+";  

  String regexp = "[\\n]+";

   //this one didn't work  
   //String[] lines = text.split(regexp);



    String[] lines = text.split(System.getProperty("line.separator"));

    for(int i=0; i&lt;lines.length; i++){

    System.out.println("Line "+i+": "+lines[i]);
    ObjectwritFile.writeFile("C://testfilelines.txt","Line "+i+": "+lines[i]);

    }         
          }

    }
</code></pre>

<p>The text is in this format.</p>

<pre><code>John, Smith, 4 ,5 ,6
Adams, Olsen, 7,8, 3
Steve, Tomphson , 4,5 9
Jake, Oliver, 9,8,9
</code></pre>

<p>Once I separate text by lines I have to sort it by alphabet and but numbers into a file with same text format.</p>
