Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Tic tac toe format  RSS feed

 
Tomas Castagnino
Ranch Hand
Posts: 31
3
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I bump into this format-like kind of question:

Given the following table...



...and the following code...

String [] [] table = new String[4][4];

table[0][0] = “X”;
table[2][2] = “X”;
table[1][3] = “X”;
table[4][4]  = “X”;
table[3][4] = “X”;

...what would be the right choice if you want to complete a line of Xs?

Then you had lots of options to choose from.

It was something like that... The point was to figure out which where the rows and which the columns. The right answer was table[4][0].

It was something like that, yes. But I remember it was a little bit less obvious than my example. In any case, you get the idea.

Regards!
 
Tomas Castagnino
Ranch Hand
Posts: 31
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Edit: It should be String [] [] table = new String[5][5];

Sorry
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 4060
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the details, Tomas.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37051
507
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for sharing. That's a cool question format.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!