File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ashley Kin
Ranch Hand
Posts: 36
  • 0
  • 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
  • 0
  • 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
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • 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
Pie
Posts: 47244
52
  • 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