fork 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. final String textoIngresado = "laburadores de bus 1";
  13.  
  14. // Construir la matriz
  15. char[][] AquiAlmacenoLosCaracteresDelTexto = new char[4][5];
  16. for (int i = 0 ; i < 4 ; i++) {
  17. for (int j = 0 ; j < 5; j++) {
  18. AquiAlmacenoLosCaracteresDelTexto[i][j] = textoIngresado.charAt(j + i * 5);
  19. }
  20. }
  21.  
  22.  
  23. // Para imprimir la matriz
  24. for (int i = 0 ; i < 4 ; i++) {
  25. for (int j = 0 ; j < 5; j++) {
  26. System.out.print(AquiAlmacenoLosCaracteresDelTexto[i][j]);
  27. System.out.print(" ");
  28. }
  29. System.out.println("");
  30. }
  31.  
  32.  
  33. }
  34. }
Success #stdin #stdout 0.06s 32584KB
stdin
Standard input is empty
stdout
l a b u r 
a d o r e 
s   d e   
b u s   1