aspose file tools*
The moose likes Beginning Java and the fly likes Printing an array using nested for loops? (Code edited) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Printing an array using nested for loops? (Code edited)" Watch "Printing an array using nested for loops? (Code edited)" New topic
Author

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

Ashley Kin
Ranch Hand

Joined: Oct 18, 2011
Posts: 36
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
Bartender

Joined: May 31, 2011
Posts: 1776
The code you posted don't even compile. Please PostRealCode that you wrote.
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3068
    
  33

I dont think you need to be using Arrays.deepToString instead you can use the element variable. You are already traversing the array.


Mohamed Sanaulla | My Blog
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38334
    
  23
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Printing an array using nested for loops? (Code edited)