This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes 1D 2D array variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "1D 2D array variables" Watch "1D 2D array variables" New topic

1D 2D array variables

James Matthews

Joined: Aug 06, 2003
Posts: 4
also coming stuck with these. ive ordered your book and shouldnt have any further problems once that's arrived (he wishes!)
what are 1d and 2d array variables?
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24189

A one dimensional (1d) array is like a list of items:

A two dimensional (2d) array is like a rectangular matrix of items:

You get can an element of a 1d array with one subscript: list[2] is the int "12" (we count from 0 in Java). But you need two subscripts to get an element of a 2d array: matrix[2][1] is the int "9". 2 is the row number, and 1 is the column number. Make sense?

[Jess in Action][AskingGoodQuestions]
James Matthews

Joined: Aug 06, 2003
Posts: 4
yes both my queries are cleared up, thanks a lot.
hopefully ill start to understand it all better soon
Have you checked out Aspose?
subject: 1D 2D array variables
It's not a secret anymore!