java - How do I repeat a string in jgrasp without using a loop -


i cannot find way make repeat in way looks

 xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx 
import java.util.scanner; public class square {     public static void main (string [] args)     {         scanner kb = new scanner (system.in);         system.out.print("enter positive integer no greater 15: ");         double square= kb.nextdouble();         double k=1;         string i= "";         while (k<square+1)         {             k++;             i=i+"x";         }     } } 

the final output has letters x in square type formation if enter 8 square variable 8 across , 8 down. knew outcome of going wrong dont know hot make appear above. output looks like

 x xx xxx xxxx xxxxx xxxxxx xxxxxxx xxxxxxxx 

if i'm using 8 square

use second loop. construct string in first loop, , print repeatedly in second. or nest 1 loop inside , print characters inner loop, lines outer one.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -