wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes trying to understand array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "trying to understand array" Watch "trying to understand array" New topic

trying to understand array

Dheesan Dabycharun

Joined: Nov 16, 2009
Posts: 3

am new in java, trying to make a game of snakes n ladders, understood that an array like the below should be to make my board and image work together.
Am using an image with nos 1 to 100 designed on the boardfield.

boardfield = new Field[10][10];
for (int i = 0; i<10; i++){
for (int j = 0; j<10; j++){
boardfield[i][j] = new Field();

But i can't really understand how to make my image and my array can work together.
Anyone can advise me if i am going on the right track if i post the code here?

Tks in advance.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902

Dheesan Dabycharun wrote:But i can't really understand how to make my image and my array can work together.

Of course, you can add one more instance variable into class 'Field' which hold image for that board.

And welcome to JR.

[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
It is sorta covered in the JavaRanch Style Guide.
subject: trying to understand array
Similar Threads
2-Dimensional Arrays?
Programing a sudoku solver
data structure of choice.
Database to multi-dimensional array problem
storing a set of integers in an array