fork(2) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12.  
  13. String resultado ="";
  14. String frase = "Me gusta programar.";
  15. String[] strWords = frase.split(" ");
  16. List<String> list = Arrays.asList(strWords);
  17. Collections.reverse(list);
  18.  
  19. for (String part : list) {
  20. resultado += part + " ";
  21. }
  22. System.out.println(resultado);
  23.  
  24. }
  25. }
Success #stdin #stdout 0.09s 27676KB
stdin
Standard input is empty
stdout
programar. gusta Me