• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Printing an array using nested for loops? (Code edited)

 
Ashley Kin
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm trying to print this tic-tac-toe board out using arrays and nested for loop.
The board has 3 rows and 3 columns.



This is what I have so far, and it's printing the same String of the array board three times with || between.
I've been stuck for a while and I'd appreciate any help, thanks!

 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code you posted don't even compile. Please PostRealCode that you wrote.
 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont think you need to be using Arrays.deepToString instead you can use the element variable. You are already traversing the array.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The way this website is set up, multiple whitespace does not appear. You should enclose your printout in code tags. I have edited your post, and you can see how much better it looks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic