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. int width = 20;
  13. int height = 20;
  14. char[] canvas = new char[width*height];
  15. Arrays.fill(canvas, ' ');
  16.  
  17. for(int i = 0; i < 10; ++i){
  18. canvas[0*height+i] = '*';
  19. canvas[9*height+i] = '*';
  20. canvas[i*height] = '*';
  21. canvas[i*height+9] = '*';
  22. canvas[i*height+i] = '*';
  23. canvas[(9-i)*height+i] = '*';
  24. }
  25.  
  26. for(int y = 0; y < height; ++y){
  27. for(int x = 0; x < width; ++x)
  28. System.out.print(canvas[y*width+x]);
  29. System.out.println();
  30. }
  31. }
  32. }
Success #stdin #stdout 0.06s 380224KB
stdin
Standard input is empty
stdout
**********          
**      **          
* *    * *          
*  *  *  *          
*   **   *          
*   **   *          
*  *  *  *          
* *    * *          
**      **          
**********