java - How to draw asterisks (*) line on the screen? -


how can draw horizontal line using around 50 asterisks * , using loop? when tried this, result 50 asterisk listed vertically (instead of horizontally).

public void drawastline() {      (int = 0; < 3; i++)           system.out.println("*");  } 

any suggestions?

you need use system.out.print('*') instead of system.out.println('*').

 system.out.println('*'); => system.out.print('*'); system.out.print('\n'); 

for case, output looks *\n*\n*\n*\n*\n, \n escape sequence inserts newline in text @ point. print('*') allows avoiding , output *****.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -