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.