• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java code to print 3 * 3 matrix

 
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Printing an array of arrays and printing a matrix are similar but not exactly the same.
 
reply
    Bookmark Topic Watch Topic
  • New Topic