title: sorting strings using bubblesort in java
body: <p>I tried sorting strings using bubblesort, but I dont know whether it makes any sense but can someone just help me figure out how to sort strings and let me know if my logic is correct? i have converted the strings to character just to check if they are in alphabetical order..eg app ban acc will be sorted to acc app and ban..can anyone give the logic to this problem.    </p>
  
  <pre><code>import java.io.*;
  import java.util.*;
  class sort
  {
      public static void main(String args[])throws IOException
      {
  
          BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
  
  
          System.out.println("enter the strings");
          String str=br.readLine();
          StringTokenizer st=new StringTokenizer(str,",");
          String s1=st.nextToken();
          String s2=st.nextToken();
          String s3=st.nextToken();
          char ch1[]=s1.toCharArray();
          char ch2[]=s2.toCharArray();
          char ch3[]=s3.toCharArray();
  
          if ((ch1[0]&lt;ch2[0])&amp;&amp;(ch1[0]&lt;ch3[0])&amp;&amp;(ch2[0]&lt;ch3[0]))
              for(int i=0;i&lt;4;i++)
              {
                  System.out.println(+ch1[i]);
                  System.out.println(+ch2[i]);
                  System.out.println(+ch3[i]);
  
              }
          else if((ch2[0]&lt;ch1[0]&amp;&amp;ch2[0]&lt;ch3[0]&amp;&amp;ch1[0]&lt;ch3[0]) )
              for(int i=0;i&lt;4;i++)
              {
                  System.out.println(+ch2[i]);
                  System.out.println(+ch1[i]);
                  System.out.println(+ch3[i]);
              }
          else if((ch3[0]&lt;ch1[0])&amp;&amp;(ch3[0]&lt;ch2[0])&amp;&amp;ch1[0]&lt;ch2[0])
              for(int i=0;i&lt;4;i++)
              {
                  System.out.println(+ch3[i]);
                  System.out.println(+ch1[i]);
                  System.out.println(+ch2[i]);
              }
      }
  }
  </code></pre>