This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes printing an 2d array by row 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 2d array by row" Watch "printing an 2d array by row" New topic

printing an 2d array by row

Ryan Perlman

Joined: Oct 31, 2001
Posts: 23
I thougth I was doing it right but with my output it is not I know I am making just one little mistake. please point me to the right spot..
here the code:

Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Ryan,
Common programming mistake. Get used to using braces for loops because it is the safest approach.
Your loop (compiler supplied braces):

What you really want:

Little things mean a lot,
I agree. Here's the link:
subject: printing an 2d array by row
It's not a secret anymore!