File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java code to print 3 * 3 matrix

 
Rajendra Prakash
Ranch Hand
Posts: 293
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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é
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Martin Vanyavchich
Ranch Hand
Posts: 241
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12015
24
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martin,

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.
 
Martin Vanyavchich
Ranch Hand
Posts: 241
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 47216
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Printing an array of arrays and printing a matrix are similar but not exactly the same.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic