wood burning stoves
The moose likes Beginning Java and the fly likes Java code to print 3 * 3 matrix Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java code to print 3 * 3 matrix" Watch "Java code to print 3 * 3 matrix" New topic

Java code to print 3 * 3 matrix

Rajendra Prakash
Ranch Hand

Joined: Sep 10, 2009
Posts: 293
I need java code to print 3 * 3 matrix . all numbers should be 3. i mean a[0,0]=3 ,a[0,1]=3 .......a[2,2]=3
3 3 3
3 3 3
3 3 3
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

Hi. After so many post, you still haven't checked HowToAskQuestionsOnJavaRanch ? First, CarefullyChooseOneForum. I'm moving this thread out of the servlets forum. Then ShowSomeEffort, DoYourOwnHomework and NotACodeMill.

[My Blog]
All roads lead to JavaRanch
Martin Vanyavchich
Ranch Hand

Joined: Sep 16, 2008
Posts: 241
Rajendra Prakash,

I'm guessing you can't just do:

Try using loops (for, while, do/while). http://java.sun.com/docs/books/tutorial/java/nutsandbolts/for.html

I no good English.
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11855


Please refrain from simply handing out a solution of any kind. We want people to learn how to write code themselves, not copy from other people (which is potentially illegal and against every school's code of conduct).

Giving hints is fine, but no actual solutions.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Martin Vanyavchich
Ranch Hand

Joined: Sep 16, 2008
Posts: 241
fred, I didn't mean to give away a solution. I presumed, due to square brackets, that an array needs to be printed out. I will try to be more carefull in the future.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 43905
Printing an array of arrays and printing a matrix are similar but not exactly the same.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Java code to print 3 * 3 matrix
It's not a secret anymore!