gurpeet singh wrote:Thanks Seetharaman. i'm having bit trouble in visualizing 2-d arrays.
That shouldn't be a problem, because
Java does not HAVE 2-d arrays (or really, any multi-dimensional array). Java only has 1-d arrays.
What you need to wrap your head around is that a java array can hold anything - including an array! So when you say something like "String[][]", what you really get is an array that can hold a bunch of arrays that hold Strings. I have an egg analogy:
an object is an egg
a 1-d array is an egg carton - it holds eggs
a 2-d array is a crate that holds egg cartons which hold eggs
a 3-d array is a shipping pallet that holds crates that hold cartons that hold eggs
etc...