简体   繁体   中英

print 2D array and print * for odd numbers

enter image description here why does the console print my 2D array in a row?

You're using System.out.print which doesn't append a newline to the end of your output, meaning it will just keep printing everything to the same line.

You can add the line System.out.println() inside your top-level loop, but after your inner loop, and it will log each 2nd-level array to it's own line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM