Advertisement
cd62131

String to Char Array and Sort

Jul 9th, 2017
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.28 KB | None | 0 0
  1. import java.util.Arrays;
  2.  
  3. public class StringSort {
  4.   public static void main(String[] args) {
  5.     String[] words = { "dictionary", "next" };
  6.     for (String s: words) {
  7.       char[] cs = s.toCharArray();
  8.       Arrays.sort(cs);
  9.       System.out.println(cs);
  10.     }
  11.   }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement