Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- public class Test {
- public static void main(String[] args) throws Exception {
- Sentence s1 = new Sentence(" Hello world !"); //order = 5
- Sentence s2 = new Sentence("Abc def! ghijk"); //order = 5
- Sentence s3 = new Sentence(" Yaho"); //order = 4
- Sentence s4 = new Sentence("Computer "); //order = 8
- Sentence s5 = new Sentence(""); //order = 0
- Sentence[] arr = new Sentence[]{s1, s2, s3, s4, s5};
- Arrays.sort(arr);
- for (Sentence s : arr) {
- System.out.println(s);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement